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?
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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.