Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12834

Document that $geoWithin cannot contain multiple fields

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: 4.0.9
    • Component/s: Server
    • Labels:
      None

      $geoWithin cannot contain an implicit $and and must only have one field. We should clearly indicate this in the documentation. There may be other operators that also need to be clarified.

      Original Description

      Parser rejects the following query:

      {"coordinates": {
          "$geoWithin": {"$centerSphere": [[22, 52], 0.04]},
          "$not": {
              "$geoWithin": {"$centerSphere": [[22, 52], 0.01]}
          }
      }}

      with the following error:

      {
      	"ok" : 0,
      	"errmsg" : "can't parse extra field: $not: { $geoWithin: { $centerSphere: [ [ 22.0, 52.0 ], 0.001 ] } }",
      	"code" : 2,
      	"codeName" : "BadValue"
      }
      

      Tested on Mongo 4.0.9

            Assignee:
            Unassigned Unassigned
            Reporter:
            starzu Mateusz Starzec
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              1 year, 33 weeks ago