发布于 2015-09-14 15:20:16 | 130 次阅读 | 评论: 0 | 来源: 网络整理
Use the cursor.addOption() method on a cursor to add OP_QUERY wire protocol flags, such as the tailable flag.
参数: |
|
---|
For the mongo shell, see the list of cursor flags available in the shell. For the driver-specific list, see your driver documentation.
The following example in the mongo shell adds the DBQuery.Option.tailable flag to ensure the cursor returned from the query is a tailable cursor:
var t = db.myCappedCollection;
var cursor = t.find().addOption(DBQuery.Option.tailable);
警告
Adding incorrect wire protocol flags can cause problems and/or extra server load.