Mongodb 6.0 error: Unsupported OP_QUERY command: listCollections. The client driver may require upgrade

529 Views Asked by At

We are upgrading Node and Mongodb version for our applications. We have upgraded

Mongodb: 6.0.8
NodeJs Mongo Driver: 6.0.0
NodeJs: 18.17.0
db-migrate: 0.11.14

in migrations file we are declaring MongoClient like this

var MongoClient = require('mongodb').MongoClient;

below error we are getting while running the migrations for creating the table and dbs. Error: [Error] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Unsupported OP_QUERY command: listCollections. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal at module.exports (/node_modules/db-migrate/lib/commands/up.js:29:16)

We were using mongodb 3.x and Nodejs 14.x versions, when we have upgraded to mongodb 6.x and Nodejs 18.x, we are getting this unsupported OP_QUERY error, not able find the solution because lack of documentation.

What should be the Node driver version with below configuration?

Mongodb: 6.0.8
NodeJs Mongo Driver: 6.0.0
NodeJs: 18.17.0
0

There are 0 best solutions below