Skip to content

entangler/oploggery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oploggery

Join the chat at https://gitter.im/entangler/oploggery

A MongoDB oplog watcher for Node.js, part of the entangler.js project.

client allows you to pass an already connected MongoClient instance from the MongoDB Node.js native driver (see MongoClient().)

uri allows you to pass a MongoDB connection URI string, frequently generated by hosted MongoDB services such as compose.io. A simple URI for a local MongoDB server might look like this:

mongodb://localhost:27017/test

Install

To install oploggery from npm, run:

npm install oploggery

Usage

To watch a collection:

var Oploggery = require('Oploggery');

var oplogger = new Oploggery({
	uri: 'mongodb://localhost:27017/test',
	format: 'pretty'
});

// Database is 'test', collection is 'users'
oplogger.watch('test.users', function(event) {
	console.log(event);
});

Credits

This library is based heavily off Mongo Watch by Brandon Mason. Big thanks for making this so easy!

More documentation, tests, examples etc. to come!