Outdated mongodb driver dependency in @types/meteor package

The current @types/meteor package sets a dependency to

"mongodb": "^4.3.1"

However, since Meteor 3.1, Meteor uses mongodb 6.10.0 / 6.9.0:

This becomes noticable when you use db.rawCollection() and methods like db.collection.findOneAndUpdate() which changed its result type since mongodb 5.x.

I also stumbled upon this when I wanted to use agenda in combination with Meteor. Since @types/meteor pulls in mongodb@4.17.2 which itself sets a dependency on bson@4.7.2, agenda tries to use bson@4.7.2 as well, which is incompatible with Meteor’s current bson@6.10.4, causing runtime errors. I had to fix this by pulling in mongodb@6.21.0 on top-level, which is an ugly workaround.

Proposed solution: Add a new major for @types/meteor that sets a dependeny to mongodb@^6.9.0.

I opened an issue in the @types repository:

but I thought I’d copy this note here. Maybe someone in the Meteor team wants to check this.

Posted this one the github issue as well, but aren’t the types within packages and unpacked by zodern:types the authoritative source since meteor 3? DefinitelyTyped types have been deprecated and abandoned, right?

agree, the most apropriated is to update zodern:types

I have zodern:types installed, but still got the outdated MongoDB driver types.

Please, test this PR in your enviroment, let me know if the fix has gone

Sounds promising. Is there a way to test this in isolation, i.e. without upgrading Meteor to a dev version?

do you mean in production or locally? if locally, you can follow this instructions