node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


build status #Oplog Transform Tail Tail the MongoDB oplog and update a secondary store in real time


This is just a combination of oplog-transform and mongo-oplog to make a seemless tool for tailing the MongoDB oplog and performing the changes on a secondary store.


var tail = require('oplog-transform-tail')
  url: "mongodb://", //optional 
  //Function to call when an insert occurs 
  insert: function(_id, doc, cb) {
    /* insert doc */
  //Function to call when an update occurs 
  update: function(_id, done){
    var retrievedDoc = /* fetch doc from your secondary store */
    done(retrievedDoc, function(err, updatedDoc, cb) {
      /* store updated doc */
  //Function to call when an delete occurs 
  remove: function(_id, cb) {
    /* delete doc */

See the oplog-transform docs for more in-depth info about how the insert, update, and remove hooks work.

Made with ⚡️ by @taterbase