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

Document that $geoWithin cannot contain multiple fields

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • 4.0.9
    • Server
    • None

    Description

      $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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago