Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including oplog-transform-tail with all npm packages installed. Try it out:

var oplogTransformTail = require("oplog-transform-tail")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

oplog-transform-tail v1.1.0

Tail the MongoDB oplog and update a secondary store in real time.

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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free