Run this code and then update any record in "users" collection. You will get exception:
TypeError: Cannot read property 'u' of undefined
at EventEmitter.onop (/var/www/project/node_modules/mongo-oplog/lib/filter.js:28:23)
at EventEmitter.emit (/var/www/project/node_modules/eventemitter3/index.js:129:35)
at Cursor.ondata (/var/www/project/node_modules/mongo-oplog/lib/index.js:128:11)
at Cursor.emit (events.js:159:13)
at addChunk (_stream_readable.js:265:12)
at readableAddChunk (_stream_readable.js:252:11)
at Cursor.Readable.push (_stream_readable.js:209:10)
at /var/www/project/node_modules/mongodb/lib/cursor.js:1110:10
at handleCallback (/var/www/project/node_modules/mongodb/lib/utils.js:120:56)
at /var/www/project/node_modules/mongodb/lib/cursor.js:683:5
I suppose it happens because index.js includes filter.js:
const createFilter = require('./filter');
and filter.js includes index.js:
var _require = require('./');
and you can see "_require" is empty object. Probably, circular dependencies issue.
Looks like filter feature broken in version 2.1.0.
Code to reproduce:
Run this code and then update any record in "users" collection. You will get exception:
I suppose it happens because index.js includes filter.js:
and filter.js includes index.js:
and you can see "_require" is empty object. Probably, circular dependencies issue.