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

$geoWithin cannot contain multiple fields

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

      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@mongodb.com John Stewart (Inactive)
            Reporter:
            starzu Mateusz Starzec
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: