MongoDB 4.4 deprecated. Problem updating a legacy Meteor Project from 1.10.2 to 2.6

Hi guys,

I have a really old project that is using Meteor 1.10.2 + MongoDB 4.4.
Recently forced to migrate from MongoDB 4.4 to MongoDB 5.0.
Understanding that Meteor 1.10.2 is not supposed to work with MongoDB 5.0. I am trying to upgrade the Meteor version to Meteor 2.6. But it didn’t work:

Meteor 1.10.2 + MongoDB 5.0 + oplog = fast but update products etc failed randomly
Meteor 1.10.2 + MongoDB 5.0 + no oplog = fast and update products etc success
Meteor 2.6 + MongoDB 5.0 + oplog = extreme slowness. not usable
Meteor 2.6 + MongoDB 5.0 + no oplog = app crash. boot timed out

Any idea how should I proceed to investigate this?

The suggested upgrade path is to do one version at a time to pinpoint the exact problem along the way.

If time/effort is a constraint, I suggest the following steps:

  1. Check the minimum mongodb driver that supports Mongodb 5
  2. Check the minimum meteor version that supports that driver
  3. Upgrade to that Meteor version

[erratum]
I just realized that you are referring to version 2.6 that might already be #2 above.

Yes someone pointed Meteor 2.6 to me.

Quote from Meteor 2.6 migration guide:

Meteor before 2.6 was supporting MongoDB Server 4.x, starting from this version we’ve upgraded to MongoDB Node.js driver from version 3.6 to 4.3.1 which supports MongoDB Server 5.x.

However, since upgrading to Meteor 2.6 didn’t immediately work for me for some unknown reasons, and it appears that reusing Meteor 1.10.2 on MongoDB 5 actually kind of works for me, (as long as I removed oplog url path), is it silly to keep using Meteor 1.10.2 on MongoDB 5?

Just check the MongoDB driver version in 1.10.2. Then cross-check the version of MongoDB that the driver supports.

If you were using MongoDB 4.4, then the compatibility matrix suggests that you can use MongoDB 5.0 without issue (but you might not be able to use feature new to MongoDB 5.0)

Thanks so much for the confirmation that my app should work with MongoDB 5.0 without issue.

Currently this it only works if I turn off oplog, but very worrying because the legacy project already has oplog configured for years.

This is an example of error that I will get, if I have oplog configured (Meteor 1.10.2 + MongoDB 5 + oplog):


c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244 Uncaught Error: Inconsistent operator: {"_id":"6b3ReJRxQpE6NN7jn","$v":2,"diff":{"u":{"allocations":[{"_id":"7pFmiHyChpqSHmutF","productId":5,"quantityInPieces":4}]}}}
    at c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:8905
    at Array.forEach (<anonymous>)
    at S (c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:8820)
    at w._modify (c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:27720)
    at w._modifyAndNotify (c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:22104)
    at c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:21219
    at c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:21863
    at Array.some (<anonymous>)
    at w._eachPossiblyMatchingDoc (c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:21812)
    at w.update (c4843f4d275f08447bc858507a1278cdcffe6802.js?meteor_js_resource=true:244:21107)

This happens randomly, when I try to perform some simple task, like update the price of a product etc.

This issue is gone if I remove the oplog URL completely.

Any clues on what could be the reason?

This requires someone with more experience with oplog. I don’t have any meteor project with oplog tailing so my experience is very limited

Sounds like oplog is not quite needed in production! haha
Thanks for the help so far.

I’m afraid I don’t have the versions previous to 2.5 very fresh in my head so definitely check through the migration docs there. But the big change from 2.5->2.6 to get the updated driver for 5.0 is that some of the core mongo methods changed. Do you use rawCollection anywhere ? Take a look for those (in the migration doc there’s a link to the underlying driver changes).

I have scanned through the change logs and unfortunately no mention of meteor oplog breaking changes, or anything related to the “Inconsistent operator…$v” error that I am facing whenever oplog is turned on in Meteor 2.6…

p/s: Also did a search, not using RawCollection anywhere.

Is it possible that somehow the update didn’t resolve all the package correctly and you’ve ended up with an old version of mongo ? We’re on 2.7.3 and have mongo@1.15.0. It looks to me like it’s not able to understand the new oplog format (which I’m guessing has that $v: 2).

edit: meant to say ‘mongo’, not ‘npm-mongo’

Attached the versions changes when I upgrade Meteor from 1.10.2 to to 2.6.
mongo 1.10.0 → 1.14.0
npm-mongo 3.7.1 → 4.3.1

Hmm maybe I will try Meteor 2.7.3 too when I have time.

Also, if anyone is reading this, I would like to know if anyone of you actually successfully running MeteorJS project without MONGO_OPLOG_URL for a client.

p/s: My project only have about 20-30 concurrent users, and they have a very powerful instance.

Since I just removed the OPLOG for this client yesterday I want to know if I can sleep peacefully lol.

Do you use reactivity features? If not, you do not need it.