Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
Description
It's possible to add flags to mongoDB cursors to change the behavior of queries.
These flags are documented in the wire protocol but are not documented as part of the cursor options.
You can set these flags using the addOption() modifier, which is also not documented. Here's an example:
|
|
ldb = db.getSiblingDB("local");
|
c = ldb.oplog.rs.find( {ts: {$gte: Timestamp(1356412260000, 94) } } ).
|
addOption( DBQuery.Option.tailable).
|
addOption( DBQuery.Option.awaitData).
|
addOption( DBQuery.Option.oplogReplay )
|
|
|
var i = 0;
|
while( c.hasNext() ) {
|
doc = c.next();
|
printjson( doc);
|
}
|
|
|