cayasso / mongo-oplog

Watch mongodb oplog in a simple way
381 stars 91 forks source link

Does work? Nothing output. #30

Closed itlodge closed 8 years ago

itlodge commented 8 years ago

Hi, I try to use this module, and write some testing code below:

var MongoOplog = require('mongo-oplog');
var oplog = MongoOplog('mongodb://127.0.0.1:27017/local',
  {ns: 'test_sails.question'}).tail();
console.log(oplog);
oplog.on('update', function (doc) {
  console.log(doc);
});
oplog.on('error', function (error) {
  console.log(error);
});

And I run this code, then do an update operation of collection "question". But nothing happen. Do I doing something wrong? Thanks.

cayasso commented 8 years ago

@itlodge Did you setup your Mongo with Replica Set as mentioned at the end of the README?

itlodge commented 8 years ago

@cayasso , Yes, I set my Mongo with Replica Set, and I can see the oplog in a mongo shell.

cayasso commented 8 years ago

Please try cloning the project and running the test suite.

On Wednesday, March 16, 2016, Yuanhang Zheng notifications@github.com wrote:

@cayasso https://github.com/cayasso , Yes, I set my Mongo with Replica Set, and I can see the oplog in a mongo shell.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/cayasso/mongo-oplog/issues/30#issuecomment-197665119

J.B.

itlodge commented 8 years ago

@cayasso , if I run only one mongod instance with option "master", can this module work?

itlodge commented 8 years ago

Now it works after I set it with Replica Set. Thanks for your help!