MulaiMulai sekarang secara gratis

List databases and collections

It's always a good idea to know what databases exist on a server before you start querying. Let's get to it!

Latihan ini adalah bagian dari kursus

Introduction to MongoDB in Python

Lihat Kursus

Petunjuk latihan

  • Print out all databases by calling the appropriate method on the client.
  • Print out all of the collections inside the film database.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

from pymongo import MongoClient 
client = MongoClient()

# Print out the names of all databases in your server
print(____)

# Print out the names of all collection in the film database
print(____)
Edit dan Jalankan Kode