I have the following data structure:
{ _id : ObjectId(...),
name : "...",
addresses : [ {
context : "home" ,
loc : [ 55.5, 42.3 ]
} ,
{
context : "home",
loc : [ -74 , 44.74 ]
}
]
}
I create a object with a embedded list called "addresses". Now I want to find all addresses in the list near to a given location with the geo-spatial query method "near" of morphia.
My problem is that I have to handle a embedded list and not a query. Is this possible with the "near method"?
You should just be able to query against
addresses.loc
. We're wandering a little bit in to unfamiliar territory with this document structure for me but I pretty sure this will work.