I seem to be trying to find the right way to delete a document. That is, should I use remove () or delete_one (), as well as the canonical method of removing by id, which is string .
those. whether to use the following:
mongo.db.xxx.delete_one({'_id': { "$oid" : str(_id) } })
or can i use a different format?
mongo.db.xxx.remove({'_id': { "$oid" : str(_id) } }) mongo.db.xxx.remove({'_id': ObjectId(_id) })
What is the canonical form?
source share