Python insert data to DB

Hi. I was trying to insert data onto the DB with python.
I can connect to DB following this:
https://docs.moralis.io/moralis-dapp/database/direct_access

But when I wanted to insert data doesn’t seem to work:

client = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
db = client[ “testDB” ]
col = db[ “testCol” ]
result = col.insert_one( {“foo” : “bar” })
print(result)

The result can’t be found on the DB browser interface.

Your code should be something like:

client = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
db = client['parse']['testDBorClassNameHere']

result = db.insert_one( {"column" : "value", "anothercolumn": "value" })
print(result)

You have to take care how you set the object id when you do that type of insert, it has to be string