node.jsmongodbmongodb-oplog

Multiple mongo-oplog instances for Node.js


I'm trying to read in and loop through a configuration file which contains different mongoURIs and then trying to monitor their activity using mongo-oplog. I don't really know how to set the listeners (such as for update, insert, and delete) for all of these databases dynamically. Any ideas as to how I can go about doing so?


Solution

  • This is what I ended up doing (in case it helps someone out in the future).
    I stored each URI in a list along with anther list that contains it's details like DB and collection name, and it turns out that you can loop through the list and set up each mongo-oplog one by one.
    After you're done doing that the listeners are still active and whatever action you specified will be executed without you having to do anything related to the mongo-oplog again.