Click here to Skip to main content
15,940,246 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Looking for some python library that can check if the MongoDB query is logically and syntactically correct.

What I have tried:

I have tried mongodb-query-parser and mongodb-language-model in nodejs but both of these are not available in Python.

1 solution

I seriously doubt it. The "source of truth" for whether the syntax is correct or not is going to be the mongoDb engine itself. It makes no sense to write another library to check the syntax when that ability is already in the db engine.

Think of it this way. Why would I write a library to check syntax and correctness against the database when the syntax can change between different versions of the database engine? Why would I write a library to check the correctness of the query against the database when I would have to go through the database engine to do that?

It's pointless to duplicate that kind of work.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900