发布于 2015-09-14 15:20:16 | 130 次阅读 | 评论: 0 | 来源: 网络整理

cursor.addOption(<flag>)

Use the cursor.addOption() method on a cursor to add OP_QUERY wire protocol flags, such as the tailable flag.

参数:
  • flagOP_QUERY wire protocol flag. See MongoDB wire protocol for more information on MongoDB Wire Protocols and the OP_QUERY flags.

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.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务