Reputation: 71
I want to find the _id
of a document of a collection (mycol)
where "name":"John"
. I have inserted the document but want to find the _id
of document. Is it possible ? I am trying as
result = db.mycol.find({"_id": {"name": "John"}})
But it is returning a cursor object.
pymongo.cursor.Cursor object at 0x00000000030E3DD8>
Then I tried as
for itm in result:
print (itm)
But it is not printing anything.
Upvotes: 2
Views: 3992