[DOCS-1040] Add cursor.addOption() to reference section. Created: 24/Jan/13  Updated: 04/Mar/15  Resolved: 12/Apr/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: v1.2

Type: Task Priority: Major - P3
Reporter: William Zola Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 10 years, 44 weeks, 1 day ago

 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);
}
 



 Comments   
Comment by auto [ 16/Apr/13 ]

Author:

{u'date': u'2013-04-12T15:24:46Z', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-1040 addOption edits

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: v2.2
https://github.com/mongodb/docs/commit/50781e67b104855016d90a11be78c903ab98061c

Comment by auto [ 16/Apr/13 ]

Author:

{u'date': u'2013-04-12T15:24:46Z', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-1040 addOption edits

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/50a312fc73c035b8ed9994781daf1c0c55f18c64

Generated at Thu Feb 08 07:40:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.