import pymongo myclient = pymongo.MongoClient("mongodb://root:example@localhost:27017/") mydb = myclient["mydatabase"] mycol = mydb["customers"] mydict = {"text":"ahoj svet"} x = mycol.insert_one(mydict)