I am getting this error while use of parse query during login verification


I am using mac M1 and I tried to lower the mongodb-community version below 5 but the service status is showing error, only version 6 is running fine.

Are you trying to connect to a local MongoDB instance? if so what is the result of mongod --version?
If it is an Atlas cluster, is it managed by Atlas, or by you? I don’t know if it is possible to manage the version. It is probably version 6. tell if otherwise.
Last question is which package is it and which version? mongodb or mongoose? by the way, at least from the error message, you need to upgrade to a higher version then the current one you installed.

Hi again @Hemant_Kumar3 , can you please, next time, copy-paste error messages so we can find a solution faster!?

  • OP_QUERY is a legacy opcode and was removed from mongodb v5.1 and onward. Legacy Opcodes — MongoDB Manual

  • the nodejs driver for mongodb applied this change on 3.1.0 and onward.

MongoError: Unsupported OP_QUERY command: find. The client driver may require an upgrade.
 For more details see https://dochub.mongodb.org/core/legacy-opcode-removal

If someone gets this error, then that means the driver in use older than v3.1.0 and the connected database is 5.1 and higher.

If you tried to update the driver, yet still getting the same error, then delete node_modules folder and re-install packages, npm install. if it is a container image, then it needs to be rebuilt (removing from the cache, if needed, as commands are recorded as layers, and layer may not be replaced if command is the same)

@Stennie_X , thanks for the ping edit. I came across this error in another post, and now I found out an explanation :slight_smile:

2 Likes