Aan de slagGa gratis aan de slag

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!

Deze oefening maakt deel uit van de cursus

Introduction to MongoDB in Python

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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(____)
Code bewerken en uitvoeren