I have a collection of like so :
db.records.save( {
name : "John Smith",
addresses : [ {
context : "home" ,
loc : [ 55.5, 42.3 ]
} ,
{
context : "work",
loc : [ -74 , 44.74 ]
}
]
} )
And I've created an index like this:
db.records.createIndex( { "addresses.loc": "2d" } )
Now when I try and make a query like:
db.Company.findOne({ "stores.loc" : { $near :[55.5, 42.3]}})
What I expect to get is john smite with an array of addresses with only the relevant address, what I get is john smite with all of the addresses, So I do not know.
How do I solve this?