geo query with $elemMatch not working with $near

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.2.0, 2.2.1
    • Component/s: Geo, Querying
    • Environment:
      all
    • Query
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      > db.revdirection.find({"address" : {$elemMatch:{"loc":[72.81668,18.90649],name:"end1"}}},{address:1})
      { "_id" : ObjectId("50978c078ef31a13c9000019"), "address" : [ 	{ 	"loc" : [ 	72.83017000000001, 	19.0035 ], 	"name" : "start1" }, 	{ 	"loc" : [ 	72.81668, 	18.90649 ], 	"name" : "end1" } ] }
      > db.revdirection.find({"address" : {$elemMatch:{"loc":[72.81668,18.90649]}}},{address:1})
      { "_id" : ObjectId("50978baa8ef31a13a2000019"), "address" : [ 	{ 	"loc" : [ 	72.83017000000001, 	19.0035 ], 	"name" : "end1" }, 	{ 	"loc" : [ 	72.81668, 	18.90649 ], 	"name" : "start1" } ] }
      { "_id" : ObjectId("50978c078ef31a13c9000019"), "address" : [ 	{ 	"loc" : [ 	72.83017000000001, 	19.0035 ], 	"name" : "start1" }, 	{ 	"loc" : [ 	72.81668, 	18.90649 ], 	"name" : "end1" } ] }
      { "_id" : ObjectId("509791028ef31a1474000019"), "address" : [ 	{ 	"loc" : [ 	72.83017000000001, 	19.0035 ], 	"name" : "start" }, 	{ 	"loc" : [ 	72.81668, 	18.90649 ], 	"name" : "end" } ] }
      > 
      > 
      > db.revdirection.find({"address" : {$elemMatch:{"loc":{$near:[72.81668,18.90649]},name:"end1"}}},{address:1})
      error: {
      	"$err" : "can't find special index: 2d for: { address: { $elemMatch: { loc: { $near: [ 72.81668000000001, 18.90649 ] }, name: \"end1\" } } }",
      	"code" : 13038
      }
      > 
      

              Assignee:
              Backlog - Query Team (Inactive)
              Reporter:
              raxit sheth
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: