Run
import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") #use database named "organisation" mydb = myclient["organisation"] #use collection named "testers" mycol = mydb["testers"] #a document tester = { "name": "Saranya", "address": "Kochi" } #insert a document to the collection x = mycol.insert_one(tester) print("List of Collections\n--------------------") #list the collections for coll in mydb.list_collection_names(): print(coll)
Output