How to query $near in CosmosDB via mongoDB protocol

此生再无相见时 提交于 2019-12-11 05:37:48

问题


I have this document

{
    "_id" : "8cbc4fdc79d5479c95deaab471d359bb",
    "category" : "test",
    "location" : {
        "name" : "Café Café",
        "coordinates" : {
            "type" : "Point",
            "coordinates" : [ 
                34.788589, 
                32.0857813
            ]
        }
    }
}

And this query returns 0 records on CosmosDB, but works as expected on real mongoDB

db.activities.find({'location.coordinates': { $near :{$geometry: { type: "Point",  coordinates: [ 34.788589, 32.0857813 ] }}}})

回答1:


Based on my test, if I use $near in a query, as you said, it returns 0 records on Azure Cosmos DB.

As far as I know, not all of MongoDB's query syntax / capabilities are implemented in Azure Cosmos DB: MongoDB API. if possible, you can open a feedback item on Azure Cosmos DB User Voice and track updates.



来源:https://stackoverflow.com/questions/45631169/how-to-query-near-in-cosmosdb-via-mongodb-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!