$geoWithin cannot contain multiple fields

XMLWordPrintableJSON

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

      As discussed in 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),
        )
      )
      

              Assignee:
              John Stewart (Inactive)
              Reporter:
              Mateusz Starzec
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: