Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1291

And and Or filter builder methods should handle zero clauses correctly

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.4.2
    • Affects Version/s: 2.0
    • Component/s: API
    • None

      The Filter builder And and Or methods should handle empty lists of clauses by rendering them to $and and $or operators with empty arrays:

      builder.And() => "{ $and : [ ] }"
      builder.Or() => "{ $or : [ ] }"
      

      It is not really obvious what semantics And and Or should have when the list of clauses is empty. By rendering them this way we leave it up to the server to decide. The server currently returns error messages for both of these, but it might conceivably support them in the future.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: