Skip to content

mmotel/node-mongo-oplogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-mongo-oplogger

Node.js & MongoDB: Oplog tailing

Idea

  var Oplogger = require('node-mongo-oplogger');

  var Oplog = Oplogger.tail(MONGO_URL, MONGO_OPLOG_URL,
                {'db': 'dbName', 'colls': ['collName', ...]});

  Oplog.onInsert(function (item) {
    // item {
    //   db: dbName,
    //   coll: collName,
    //   _id: MongoObjectId,
    //   doc: {  } // inserted document
    // }
  });

  Oplog.onUpdate(function (item) {
    // item {
    //   db: dbName,
    //   coll: collName,
    //   _id: MongoObjectId,
    //   modifier: {  } // update query
    // }
  });

  Oplog.onRemove(function (item) {
    // item {
    //   db: dbName,
    //   coll: collName,
    //   _id: MongoObjectId
    // }
  });

About

Node.js & MongoDB: Oplog tailing

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors