websucker-pip/mongo/mongoindexer.py

11 lines
208 B
Python
Raw Normal View History

2023-03-05 14:44:49 +00:00
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)