The Mongo server and the Meteor query disagree on how many documents match your query

Can anyone hint on what is happening here?
I don’t know where to start searching for this error.

=> App running at: http://localhost:3000/
W20200901-15:24:47.130(2)? (STDERR) The Mongo server and the Meteor query disagree on how many documents match your query. Cursor description: CursorDescription {
W20200901-15:24:47.130(2)? (STDERR) collectionName: ‘orders’,
W20200901-15:24:47.130(2)? (STDERR) selector: { orderId: undefined },
W20200901-15:24:47.130(2)? (STDERR) options: { transform: [Function] }
W20200901-15:24:47.131(2)? (STDERR) }
I20200901-15:24:47.189(2)? Exception in defer callback: Error: The Mongo server and the Meteor query disagree on how many documents match your query. Maybe it is hitting a Mongo edge case? The query is: {}
I20200901-15:24:47.190(2)? at packages/mongo/oplog_observe_driver.js:884:15
I20200901-15:24:47.190(2)? at Object.Meteor._noYieldsAllowed (packages/meteor.js:778:12)
I20200901-15:24:47.190(2)? at OplogObserveDriver._publishNewResults (packages/mongo/oplog_observe_driver.js:851:12)
I20200901-15:24:47.190(2)? at OplogObserveDriver.proto._publishNewResults (packages/mdg:meteor-apm-agent/lib/hijack/wrap_observers.js:23:38)
I20200901-15:24:47.190(2)? at OplogObserveDriver._runQuery (packages/mongo/oplog_observe_driver.js:758:10)
I20200901-15:24:47.190(2)? at OplogObserveDriver._runInitialQuery (packages/mongo/oplog_observe_driver.js:658:10)
I20200901-15:24:47.190(2)? at packages/mongo/oplog_observe_driver.js:191:10
I20200901-15:24:47.224(2)? at packages/mongo/oplog_observe_driver.js:15:9
I20200901-15:24:47.224(2)? at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
I20200901-15:24:47.224(2)? at packages/meteor.js:550:25
I20200901-15:24:47.224(2)? at runWithEnvironment (packages/meteor.js:1286:24)

This happens for example when you manually insert a document on a client side collection and then subscribe to a publication that targets this same collection.

I get this error while loading a page after restart. I’m not adding anything, only trying to read from the collection. Is this persistent in some way between reboot?
Can I reset anything to get passed this error?

OK, I dropped the collection, and the error disappear, but when I copy the collection back, the error is back.

The stack trace mention something about oplog. But is the build in local database in Meteor using oplog?

Found the error, I did a publish with Order.find( { orderId: undefined } )

/closed

1 Like