$geoNear operator does not work in sharded cluster

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      $geoNear works fine on standalone instances, but not does not seem to work in a sharded cluster.

      The following was run against a build from 1/16

      mongos> sh.addShard("localhost:27017")
      { "shardAdded" : "shard0000", "ok" : 1 }
      mongos> sh.enableSharding("test")
      { "ok" : 1 }
      mongos> sh.shardCollection("test.test", {_id:1})
      { "collectionsharded" : "test.test", "ok" : 1 }
      mongos> use test
      switched to db test
      mongos> db.test.find()
      { "_id" : 0, "loc" : [  0,  0 ] }
      mongos> db.test.ensureIndex({loc: "2d"})
      mongos> db.test.find()
      { "_id" : 0, "loc" : [  0,  0 ] }
      mongos> db.test.find({loc: {$geoNear: [0,0]}})
      error: { "$err" : "use geoNear command rather than $near query", "code" : 13501 }
      

              Assignee:
              Unassigned
              Reporter:
              Andrew Emil (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: