Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4572

Geospatial index cannot be used in $and criteria of a query?

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.0.2
    • Component/s: Geo, Querying
    • None

      Question posted on mongodb-user here http://groups.google.com/group/mongodb-user/browse_thread/thread/41173a4a2c62f0be

      Quick synopsis is I'm getting this error back from the shell

      Wed Dec 28 12:39:01 uncaught exception: error {
      "$err" : "can't find special index: 2d for: { $and:[ { geometry.centroid:

      { $near: [ -37.817532, 144.967148 ],$maxDistance: 5.0 }

      },

      { identity.type_name: \"airport\" }

      ] }",
      "code" : 13038

      when using $near on a geospatial index in an $and query. Pulling the $near outside the $and gets the expected behavior.

      I can't see any caveats in the docs on geospatial queries or $and that indicates any restrictions here.

            Votes:
            17 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: