-
Type: Question
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Builders
-
None
Summary
We have multiple filters with $expr in a list, and we are passing this list in to method
AggregateIterable<TDocument> aggregate(List<? extends Bson> pipeline); of class MongoCollection.
If we have and filter in it and if you see com.mongodb.client.model.Filters.AndFilter it will l combine all the condition into one condition.
Value passed as :
{"$expr": {"$eq": [ {"$strcasecmp": ["$CreatedBy", "tenant21"]}, 0] }} {"$expr": {"$in": [ {"$toLower": "$a"}, ["a"]] }}
Command executed:
{"$expr": {"$eq": [ {"$strcasecmp": ["$CreatedBy", "tenant21"]}, 0], "$in": [{"$toLower": "$a"}, ["a"]]}}
If you see above it will combine two $expr into single $expr and while executing it will fail saying, $expr can only contain single object.