PyMongo find_one() returns nothing when passed _id as query parameter
<p>I have a single document in my Mongo database:</p>

<pre><code>{"_id" : ObjectId("569bbe3a65193cde93ce7092"), 
 "categories" : [{_id: 0, "category": "Groceries"},
                 {_id: 1, "category": "Bills"}, . . .]}
</code></pre>

<p>Using PyMongo in my project, I get this result calling <code>find_one()</code>:</p>

<pre><code>x = db.collection.find_one({"_id": "ObjectId(\"569bbe3a65193cde93ce7092\")"})
print(x)
// None
</code></pre>

<p>Whenever I perform this same query in the Mongo shell, it returns my document. I cannot for the life of me figure out why this is not working. Using <code>find({})</code> returns the document, so I know PyMongo can see it. </p>

<p>I can call <code>find_one({"categories": {"$exists": True}})</code> to retrieve the document, and since this will be the only document containing "categories", this will work; however, now I'm just baffled as to why accessing the document by <code>_id</code> is giving me such trouble. Neither escaping the quotes nor quote-wrapping <code>569bbe3a65193cde93ce7092</code> has made any difference.</p>