列出資料庫與集合
在開始查詢之前,先知道伺服器上有哪些資料庫總是好主意。現在就來看看吧!
本練習屬於課程
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(____)