开始使用免费开始使用

列出数据库和集合

在开始查询之前,先了解服务器上有哪些数据库总是明智之举。现在就来看看吧!

本练习是课程的一部分

Python 中的 MongoDB 入门

查看课程

练习说明

  • 调用 client 上的相应方法,打印所有数据库。
  • 打印 film 数据库中的所有集合。

交互式实操练习

通过完成这段示例代码来试试这个练习。

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(____)
编辑并运行代码