You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered confusing behavior that does not lead to error.
For example ?filter={field:{$eq:"value"}} will pass map[string]interface{}{"$eq": "value"} instead of "value" to Validate functions. Proper form ?filter={field:"value"} works as expected passing "value". I assume this behavior is caused because query.Equal is a default predicate operator.
The text was updated successfully, but these errors were encountered:
MongoDB supports both variants I think compatibility is a strong argument for adding it.
It will be a breaking change to support it.
It would make more convenient playing with filters because all other filters require wrapping in object {<op>:<value>}. Counting closing braces gets bit annoying after a long day.
rest-layer only aims to support/allow a sub-set of the MongoDB query syntax, but in this case I agree. We can just add it.
Unfortunately the amount of time I have found to contribute to rest-layer have been quite limited. Are you open to attempt a PR for it? Otherwise I will try to fix it eventually.
On the note of operator parsing, I just want to mention that there are more problems to be aware of... rest-layer only allows one operator within a given dict. E.g. {$lt: 4, $gt:1} would be legal in MongoDB, but not understood by rest-layer. In rest-layer we would instead need to wrap it via an explicit and: {"$and":[{$lt: 4},{$gt:1}]}. Fixing this is a bigger change, so we will leave it out-of-scope.
I have encountered confusing behavior that does not lead to error.
For example
?filter={field:{$eq:"value"}}
will passmap[string]interface{}{"$eq": "value"}
instead of"value"
to Validate functions. Proper form?filter={field:"value"}
works as expected passing"value"
. I assume this behavior is caused becausequery.Equal
is a default predicate operator.The text was updated successfully, but these errors were encountered: