MongoDB query rules: $and should not be default on root query level #339
Replies: 3 comments
-
But then again, '$and' should be there at the root when there is at least 1 '$or' for example 🤔 |
Beta Was this translation helpful? Give feedback.
-
Never mind my last comment, this is a valid query, no $and needed: |
Beta Was this translation helpful? Give feedback.
-
Hi @WebDevMichael. Thanks for the suggestions, they look like good improvements! I do like the simpler format. (I had never actually used MongoDB in a real environment when we added the export format, I just verified the logic by checking the documentation.) Do you intend to submit a PR with the modifications? I ask because it looks like you've already published a fork of You're absolutely free to fork this project and publish an alternative version of course, but we wouldn't be able to support a fork directly. Let me know what you want to do. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm working on simplifying the mongodb query string output. At the moment all MongDB queries are surrounded with '$and' at the root of the query.
For example, this is the current output for a simple rule:
{"$and":[{"firstName":{$eq:"Test"}}]}
This can be simplified to:
{"firstName":"Test"}
Feature: When the root combinator is '$and', it should not be applied in the query. Also as you can see, the '$eq' is also redundant.
I already made many changes for this and am changing and expanding the test files.
Thanks again for this project
Beta Was this translation helpful? Give feedback.
All reactions