使用带有日期的$ eq从MongoDB获取记录,而不是日期时间

时间:2017-05-31 09:35:53

标签: mongodb

我想获取等于某个日期的记录。

I got many example of $gte, $lte, not for $eq

当我这样做时(with $gte),

db.getCollection('apiPerformance').find({CreatedAt : {$gte : new ISODate('2017-05-30')}})

然后它返回记录。

但我想让记录等于约会($eq)

db.getCollection('apiPerformance').find({CreatedAt : {$eq : new ISODate('2017-05-30')}})

然后它没有返回任何数据。

但是当我使用Date with Time过滤

db.getCollection('apiPerformance').find({CreatedAt : {$eq : new ISODate('2017-05-30 22:00:00.000Z')}})

然后返回数据。

请指导我如何使用$eq中的MongoDb来匹配日期。???

0 个答案:

没有答案