-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
What problem are you facing?
When trying to use a tailable cursor, it seems the flag `oplogReplay` is being ignore, based on `currentOp` command.
What driver and relevant dependency versions are you using?
No additional dependencies.
Steps to reproduce?
This is a complete example code. The same code can be used in different driver versions. When running this code using driver version 3.7.3 it works as expected, but starting from version 4.0 I can't see the oplogReplay option being applied which causes the query to take way longer.
const { MongoClient } = require('mongodb'); (async function () { const client = new MongoClient('mongodb://localhost:27017', { maxPoolSize: 1, }); await client.connect(); const db = client.db('local'); const _baseOplogSelector = { ns: new RegExp('^(?:rocketchat.)'), $or: [ { op: { $in: ['i', 'u', 'd'] } }, ], }; const lastEntry = await db.collection('oplog.rs').findOne(_baseOplogSelector, {projection: {ts: 1}, sort: {$natural: -1}}); const cursor = db.collection('oplog.rs').find({ ..._baseOplogSelector, ts: { '$gt' : lastEntry.ts } }, { tailable: true, awaitData: true, }); cursor.addCursorFlag('oplogReplay', true); console.log('get doc'); const doc = await cursor.next(); console.log('doc ->', doc); client.close(); })();
I've attached two different results of db.currentOp(), when using driver version 3.7.3 and 4.0.1
- depends on
-
NODE-4468 Investigate NODE-4467 - Cursor option oplogReplay ignored starting from version 4.0
- Closed