JamesOsgood / mongodb-grafana

MongoDB plugin for Grafana
MIT License
463 stars 213 forks source link

Unsupported OP_QUERY command: aggregate. The client driver may require an upgrade. MongoDB 6.0.1 #133

Open shebistar opened 2 years ago

shebistar commented 2 years ago

Using MongoDB 6.0.1 Community and the following query:

db.XXXXXX.aggregate([ { "$match": { "status": "done" } }, { "$group": { "_id": null, "done": { "$count": {} } } } ])

It returns the following error:

response:Object message:"Unsupported OP_QUERY command: aggregate. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal"

But with MongoDB 5.0 it works fine.

simplylizz commented 1 year ago

You can update package.json and set driver to the latest version (e.g. "mongodb": "^4.12.1"). Worked for me.

ChinmoyPadhi commented 1 year ago

You can update package.json and set driver to the latest version (e.g. "mongodb": "^4.12.1"). Worked for me.

@simplylizz I tried the same with "mongodb": "^6.0.1", but Jenkins is complaining No matching version found for mongodb@^6.0.1. whereas it worked with 4.12.1

Could you please help with right version, which I can use , I'm looking for version 6 and version 5

simplylizz commented 1 year ago

@ChinmoyPadhi I think you're confusing driver (i.e. node package) version & mongodb server version.

denef commented 1 year ago

You can update package.json and set driver to the latest version (e.g. "mongodb": "^4.12.1"). Worked for me.

When I do that the server fails to run. Seems a mix of NPM versions. Any ideas? https://stackoverflow.com/questions/68692038/how-to-solve-error-syntaxerror-unexpected-token

grafana-storage/plugins/mongodb-grafana-master/node_modules/mongodb/lib/operations/add_user.js:16
        this.options = options ?? {};
                                ^

SyntaxError: Unexpected token ?

--- updated node, that fixed it

We-unite commented 2 months ago

Have you got it solved? I'm facing with the same question now, but my mongodb version is 7.0.12