Projecting a field that has a 2dsphere index gets the geohash and not the actual coordinates

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.0-rc0
    • Component/s: Geo
    • None
    • Environment:
      2.4.0-rc0 on OSX
    • ALL
    • Hide
      var coll = db.getCollection("geoprojection")
      coll.drop()
      coll.insert({_id : 1, loc : {type:"Point", coordinates:[ 5 , 5 ]}, foo : 1})
      coll.insert({_id : 2, loc : {type:"Point", coordinates:[ 5 , 5 ]}, foo : 2})
      coll.insert({_id : 3, loc : {type:"Point", coordinates:[ 5 , 5 ]}, foo : 3})
      coll.ensureIndex({foo: 1, loc : "2dsphere"});
      
      coll.find({foo : {$lt:3}}, {foo:1, loc:1, _id:0}).hint({foo: 1, loc:"2dsphere"});
      
      Show
      var coll = db.getCollection( "geoprojection" ) coll.drop() coll.insert({_id : 1, loc : {type: "Point" , coordinates:[ 5 , 5 ]}, foo : 1}) coll.insert({_id : 2, loc : {type: "Point" , coordinates:[ 5 , 5 ]}, foo : 2}) coll.insert({_id : 3, loc : {type: "Point" , coordinates:[ 5 , 5 ]}, foo : 3}) coll.ensureIndex({foo: 1, loc : "2dsphere" }); coll.find({foo : {$lt:3}}, {foo:1, loc:1, _id:0}).hint({foo: 1, loc: "2dsphere" });
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Expected to get

      { "loc" : { "type" : "Point", "coordinates" : [ 5, 5 ] }, "foo" : 1 }
      { "loc" : { "type" : "Point", "coordinates" : [ 5, 5 ] }, "foo" : 2 }
      

      but get

      { "foo" : 1, "loc" : "0f20002222223122" }
      { "foo" : 2, "loc" : "0f20002222223122" }
      

            Assignee:
            David Storch
            Reporter:
            Sridhar Nanjundeswaran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: