不能由specifing ts.t找到条目(TS是时间戳类型)MongoDB中无法找到specifing ts.t条目(TS是时间戳类型)
挖OPLOG,我想弄清楚有多少操作有一秒钟。
通过指定时间戳字段找不到条目,可以使用其他字段。 $ 在蒙戈外壳:
> db.oplog.rs.findOne()
{
"ts" : {
"t" : 1335200998000,
"i" : 540
},
"h" : NumberLong("4405509386688070776"),
"op" : "i",
"ns" : "new_insert",
"o" : {
"_id" : ObjectId("4f958fad55ba26db6a000a8b"),
"username" : "go9090",
"message" : "hello, test.",
}
}
> db.oplog.rs.find().count()
419583
> db.oplog.rs.test.find({"ts.t":1335200998000}).count()
0
> db.oplog.rs.test.find({"ts.t":/^1335200998/}).count()
0
> db.oplog.rs.test.find({ts:{ "t" : 1335200998000, "i" : 540 }}).count()
0
它的工作原理,非常感谢。 – 2012-05-02 01:40:14