AndFilter merging filters into single $expr

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Builders
    • None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • 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.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Nitul Kukadia
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: