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

$geoWithin cannot contain multiple fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.10.2
    • Fix Version/s: 4.0.0
    • Component/s: Builders, Query Operations
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change

      Description

      As discussed in https://jira.mongodb.org/browse/DOCS-12834, a query with the $geoWithin operator cannot contain $not next to it.

      The following example is invalid:

      {"coordinates": {"$geoWithin": {"$centerSphere": [[22.0, 52.0], 0.04]}, "$not": {"$geoWithin": {"$centerSphere": [[22.0, 52.0], 0.01]}}}}
      

      Unfortunately the implementation of `AndFilter` optimizes the following snippet to the query above:

      Filters.and(
        Filters.geoWithinCenterSphere("coordinates", 22, 52, 0.04),
        Filters.not(
          Filters.geoWithinCenterSphere("coordinates", 22, 52, 0.01),
        )
      )
      

        Attachments

          Activity

            People

            Assignee:
            john.stewart John Stewart (Inactive)
            Reporter:
            starzu Mateusz Starzec
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: