【发布时间】:2011-08-20 13:03:35
【问题描述】:
我正在尝试通过对此集合运行查询来查找过期会话
{
"_id" : ObjectId("4e4e88b81144e5a658000000"),
"__meta" : {
"id" : "3a72c90f8455e2fd4b8a05ffa04b870a8672f1a9",
"expiration" : "3600",
"timestamp" : 1313769656
}
}
查询
db.sessions.find({$where: function(){
return (this.__meta.timestamp + this.__meta.expiration) <= Math.round(new Date().getTime()/1000);
}})
我希望得到该集合,但我得到一个空结果。
【问题讨论】:
-
我知道发生了什么。过期是一个字符串...修复它的建议?
标签: mongodb