0

Observable (docs) only seems to watch individual objects.

What is a good way to observe a collection, and call a method whenever a document is created, updated, or deleted?

Working in Ruby 2.1.2 (without Rails), Mongo and Mongoid.

B Seven
  • 44,484
  • 66
  • 240
  • 385
  • Possible duplicate of [How to listen for changes to a MongoDB collection?](https://stackoverflow.com/questions/9691316/how-to-listen-for-changes-to-a-mongodb-collection) – idmean Aug 07 '18 at 20:15

1 Answers1

1

Looks like there may be a method for achieving this detailed within the following thread: How to listen to changes to a MongoDB collection?

Community
  • 1
  • 1
Drew
  • 2,583
  • 5
  • 36
  • 54
  • That answer requires making the collection a [capped collection](http://docs.mongodb.org/manual/core/capped-collections/), which comes with some significant limitations on the capability of the collection. Another solution is to use tailable cursors with the [oplog](http://docs.mongodb.org/manual/core/replica-set-oplog/) (which is a capped collection). – wdberkeley Oct 06 '14 at 14:50