Dealing with timezone dates in MongoDB and pymongo
<p>I do not seem to be able to query records and get what I expect. For example I am searching </p>

<pre><code>today = datetime.datetime.today()
past = today + timedelta(days=-200)
results = mongo.stuff.find({"date_added": {"gt": past}}, {"id":1})
</code></pre>

<p>I have the following date specified in MongoDB:</p>

<pre><code>"date_added": {
        "$date": "2016-04-19T18:47:54.101Z"
    },
</code></pre>

<p>But I get no results! Is this down to the timezone which appears in the MongoDB date which is screwing things up.</p>

<p>This is just a typing error:</p>

<p>Try with the following code:</p>

<pre><code>results = mongo.stuff.find({"date_added": {"$gt": past}}, {"id":1})
</code></pre>

<p>You forgot about the $ sign in $gt.</p>

python mongodb pymongo