【发布时间】:2019-08-08 03:18:16
【问题描述】:
我有以下结构的文档:
{
"escalation" : null,
"reclassified" : false,
"timestamp" : "1559164897437",
"endFlow" : "false",
"channel" : "web",
"intents" : null
},
{
"escalation" : null,
"reclassified" : false,
"timestamp" : "1565196671234",
"endFlow" : "true",
"channel" : "web",
"intents" : null
}
我想在两个时间戳之间查询上述文档,例如“1559254897437”和“1563996671234”。
请注意,我将时间戳字段的值存储为字符串,而不是整数。
我尝试过的:
db.getCollection('messagelogs').find({
'timestamp':{
$lte:1559164897437,
$gte:1560351891811}
})
不幸的是,这将返回所有文档。
在两个时间戳之间获取文档的正确查询是什么?
【问题讨论】:
标签: mongodb