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

geo query with $elemMatch not working with $near

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

      > 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-server-query Backlog - Query Team (Inactive)
            Reporter:
            raxitsheth raxit sheth
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: