Show
var rs = ReplSetTest({nodes: 1});
rs.startSet();
rs.initiate();
var db = rs.nodes[0].getDB( "local" );
var findCmdRes = db.runCommand({
find: "oplog.rs" ,
tailable: true ,
awaitData: true ,
maxTimeMS: 60000
});
print( "Time after find: " + ( new Date()).toString());
printjson(findCmdRes);
var getMoreRes = db.runCommand({getMore: findCmdRes.cursor.id, collection: "oplog.rs" , maxTimeMS: 5000});
print( "Time after first getMore: " + ( new Date()).toString());
printjson(getMoreRes);
getMoreRes = db.runCommand({getMore: findCmdRes.cursor.id, collection: "oplog.rs" , maxTimeMS: 5000});
print( "Time after second getMore: " + ( new Date()).toString());
printjson(getMoreRes);
getMoreRes = db.runCommand({getMore: findCmdRes.cursor.id, collection: "oplog.rs" , maxTimeMS: 5000});
print( "Time after third getMore: " + ( new Date()).toString());
printjson(getMoreRes);
Output
Time after find: Fri Jun 10 2016 13:23:23 GMT-0400 (EDT)
{
"waitedMS" : NumberLong(0),
"cursor" : {
"firstBatch" : [
{
"ts" : Timestamp(1465579402, 1),
"h" : NumberLong("9006574743864708869"),
"v" : 2,
"op" : "n",
"ns" : "",
"o" : {
"msg" : "initiating set"
}
},
{
"ts" : Timestamp(1465579403, 1),
"t" : NumberLong(1),
"h" : NumberLong("3841223321967630675"),
"v" : 2,
"op" : "n",
"ns" : "",
"o" : {
"msg" : "new primary"
}
}
],
"id" : NumberLong("28093652894"),
"ns" : "local.oplog.rs"
},
"ok" : 1
}
Time after first getMore: Fri Jun 10 2016 13:23:23 GMT-0400 (EDT)
{
"cursor" : {
"nextBatch" : [ ],
"id" : NumberLong("28093652894"),
"ns" : "local.oplog.rs"
},
"ok" : 1
}
Time after second getMore: Fri Jun 10 2016 13:23:28 GMT-0400 (EDT)
{
"cursor" : {
"nextBatch" : [ ],
"id" : NumberLong("28093652894"),
"ns" : "local.oplog.rs"
},
"ok" : 1
}
Time after third getMore: Fri Jun 10 2016 13:23:33 GMT-0400 (EDT)
{
"cursor" : {
"nextBatch" : [ ],
"id" : NumberLong("28093652894"),
"ns" : "local.oplog.rs"
},
"ok" : 1
}