问题描述:

I would like to know how to query based on below condition in MongoDB.

let's say I have a field in a collection called created_at and it is ISODate() now I want to get all the data like ISODate() + 1 Hour greater than current time. how do I do that ? I tried searching the web. I don't understand how to search.

{

"_id" : ObjectId("55c48b37f09e091c1100002a"),

"user_id" : 1,

"flagged" : 0,

"flag_count" : 0,

"likes" : [

1,

3,

7

],

"dislikes" : [],

"img_url" : "something :D",

"place_id" : "55ba017ef09e098c1500002d",

"updated_at" : ISODate("2015-08-28T09:30:44.000Z"),

"created_at" : ISODate("2015-08-07T10:40:55.000Z"),

"moderated" : true

}

网友答案:

Create a IsoDate with one hour less and use $gt

相关阅读:
Top