fastify / fastify-mongodb

Fastify MongoDB connection plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fastify-mongodb@4.0.1 is incompatible with newer version of mongodb@4.x.

yukha-dw opened this issue · comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

3.28.0

Plugin version

4.0.1

Node.js version

16.13.1

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

Description

fastify-mongodb@4.0.1 is incompatible with newer version of mongodb@4.x.

In my case, linter will tell me there is no MongoServerError attribute in MongoDB. Even when we use ts-ignore, we couldn't select thrown MongoServerError instance with if (err instance of MongoServerError)

Steps to Reproduce

This happens when we do not specify which mongodb version to use and yarn/npm will install the latest instead (e.g 4.5.0).

Expected Behavior

No response

commented

I don't think it is the problem with this library.
Instead if MongoServerError is not inside mongodb, then it is either the problem of mongodb or your code is not updated to match the latest release.

This package do nothing to mutate mongodb, it just start the database and bind it to fastify.

I don't think it is the problem with this library. Instead if MongoServerError is not inside mongodb, then it is either the problem of mongodb or your code is not updated to match the latest release.

This package do nothing to mutate mongodb, it just start the database and bind it to fastify.

Oh my bad, i haven't explored the problem enough before making the issue. It turns out the problem exists when i have 2 different mongodb version,

  1. 4.1.0 from package.json
  2. 4.5.0 from fastify-mongodb