c0rp
c0rp

Reputation: 501

Why mongodb oplog is always empty?

I'm trying to write synchronizer between MongoDB and Lucene. Idea is to implement application that will tail oplog and reproduce everything in Lucene. As a basis I'm using this post

The problem is that my oplog is always empty:

rs0:PRIMARY> db.oplog.rs.find({},{"ts":1}).sort({$natural: -1}).hasNext()
false

rs0:PRIMARY> db.Message.find({}).count()
729

rs0:PRIMARY> db.oplog.rs.find({}).hasNext()
false

rs0:PRIMARY> db.oplog.rs.find()
rs0:PRIMARY> 

Can someone explain me what I'm doing wrong?

Upvotes: 3

Views: 1508

Answers (1)

Wan B.
Wan B.

Reputation: 18835

All replica set members contain a copy of the oplog, in the local.oplog.rs collection. In order to query the oplog you have to use the local database.

use local;
db.oplog.rs.find();

Upvotes: 7

Related Questions