MongoDB常用查询


根据时间查询

db.things.find({"createTime":{"$gt":"2015-5-21 0:0:0"}}) // 大于某个时间
db.things.find({"createTime":{"$lt":"2014-5-21 0:0:0"}}) // 小于某个时间
db.things.find({"$and":[{"createTime":{"$gt":"2015-5-21 0:0:0"}},{"createTime":{"$lt":"2015-5-22 0:0:0"}}]}) // 某个时间段

更多使用方法参照: