4

I would like to create an endless processing loop for capped collection directly in MongoDB, but I can't find how I can get tailabale cursor in MongoDB shell. It's possible in Python with tailable option in Collection.find() though..

ruph
  • 43
  • 1
  • 4

1 Answers1

7

You can add the option after find() using addOption():

db.coll.find().addOption(2) // probably want to use 2(tailable) + 32(await_data)

See all the options here: http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY

You will want to put this in a loop as even tailable cursors (w/await_data) return no results sometimes.

Scott Hernandez
  • 7,452
  • 2
  • 34
  • 25