[GAE Integration] Performing a geoNear query on SubDocument
I
Ismail Issa
started a topic
about 7 years ago
Hi,
I have a document of the following format:
{
"_id": "1",
"name": "Costa",
"description":"Costa is the biggest chain of coffee worldwide",
"stores":[{
"id":"1",
"name":"Costa store",
"description":"the very first store of costa",
"location":[25.139651,55.220234]
]}
}
and I want to use the method geoNear(x, y, options) from kinvey-sdk in order to match a location query. currently what I understood that it's available only on the document level, so my question is what is the way to perform this on the subdocument level - given that there is an available option of passing a query as per this link http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#geoNear.
Thanks,
1 Comment
I
Ivan Stoyanov
said
about 7 years ago
We don't expose 2d indexing for subdocuments. One workaround is to change the documents so that Stores are in a separate collection.
Ismail Issa
I have a document of the following format:
{
"_id": "1",
"name": "Costa",
"description":"Costa is the biggest chain of coffee worldwide",
"stores":[{
"id":"1",
"name":"Costa store",
"description":"the very first store of costa",
"location":[25.139651,55.220234]
]}
}
and I want to use the method geoNear(x, y, options) from kinvey-sdk in order to match a location query. currently what I understood that it's available only on the document level, so my question is what is the way to perform this on the subdocument level - given that there is an available option of passing a query as per this link http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#geoNear.
Thanks,