Manipulate Database/Collection
client.list_database_names()
db = client.test_database
# or
db = client['test_database']
db.list_collection_names()
collection = db['test_collection']
# or
collection = db.test_collection
db.create_collection(‘test_collection’)
db.test_collection.drop()
# or
db.drop_collection('test_collection’)
client.drop_database(‘test_database’)
import datetime
post = {
"author": "Mike",
"text": "My first blog post!",
"tags": [“MongoDB", “Python", “PyMongo"],
"date": datetime.datetime.utcnow()
}