I need to insert a mongodb document with a field id equal to the string representation of _id (historic reasons, don't ask). Short of specifying my own _id, is there any way to do it in one call?
This inserts a field that's a literal "$_id".
from pymongo import MongoClient
...
user = { "name": "ccc", "address": "Highway 37", "id": "$_id" }
result = db.users.insert_one(user)