Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1828

Filters.and methods should handle zero clauses correctly

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 3.0.2, 3.1.0
    • 3.0.1
    • API, Query Operations
    • None

    Description

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

      Filters.and(emptyList()) => "{ $and : [ ] }"
      Filters.or(emptyList()) => "{ $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.

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: