如何通过mongoDB协议在CosmosDB中查询$ near [英] How to query $near in CosmosDB via mongoDB protocol

查看:69
本文介绍了如何通过mongoDB协议在CosmosDB中查询$ near的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这份文件

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

此查询在CosmosDB上返回0条记录,但在实际的mongoDB上可以正常工作

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 ] }}}})

推荐答案

根据我的测试,如果我在查询中使用$near,如您所说,它将在Azure Cosmos DB上返回0条记录.

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

据我所知,并不是所有的MongoDB查询语法/功能都在Azure Cosmos DB:MongoDB API中实现.如果可能,您可以在 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.

这篇关于如何通过mongoDB协议在CosmosDB中查询$ near的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆