Azure Cosmos DB:我们能否使用NoSQL API访问MongoDB实例,反之亦然?

huangapple go评论60阅读模式
英文:

Azure Cosmos DB: Can we access a mongodb instance using No sql API and vice versa?

问题

Azure Cosmos DB:我们是否可以使用NoSQL API访问MongoDB实例,反之亦然?

我们有一个使用案例,我们希望使用Mongo客户端执行读取操作,然后使用NoSQL进行写入操作,都在同一个Cosmos DB实例中。这可行吗?这些API只是抽象的层吗,两种情况下的数据最终是相同的?

还是说MongoDB API和NoSQL API完全使用不同的引擎?我看到Azure UI门户对于这两者是完全不同的。所以它们是否在某个点上汇合?

我们已经设置了一个使用MongoDB的Cosmos DB实例,并尝试通过NoSQL API进行连接,但我们甚至无法连接。甚至连接方法和连接字符串也是不同的。

Mongo API有集合的概念,但在NoSQL API方面没有类似集合的东西。有容器,数据建模层次结构也不同。

英文:

**Azure Cosmos DB: Can we access a mongodb instance using No sql API and vice versa?
**

We have a use case where we want to perform reads using mongo client and writes using no sql to the same cosmos db instance? Is it feasible? Are these APIs just layers of abstraction and the data ultimately in the both the cases is the same?

Or is it like MongoDB API and No SQL API have different engines altogether? I see the Azure UI portal is entirely different for both these. So do they converge at some point?

We have a cosmos db instance set up using Mongo DB and tried connecting through no sql API and there is no way we could even connect. Even connection method and connection strings are different.

Mongo API has concept of collections but there is nothing like collections on no sql api side. There are containers and the data modeling hierarchy is different.

答案1

得分: 1

不。

以前可以连接到Mongo API帐户上的SQL API端点,但是对于使用较新版本创建的帐户,不再可以访问此端点。

即使以前可以,您使用Mongo客户端进行读取并使用NoSQL进行写入的用例也不会得到支持。

SQL端点返回的Mongo文档是BSON文档的SQL API JSON序列化版本(即,BSON文档中的每个原始属性都作为带有类型和值的子文档返回)。这种格式从未有过文档记录。

据我所知,在幕后,文档以这种NoSQL API格式存储,Mongo API网关执行翻译。当收集一些诊断日志时,以及其他一些方式中也可以看到这一点(例如,一些Mongo命令会映射到NoSQL API存储过程,因此受到5秒有界执行限制的限制)。

英文:

No.

It did use to be the case that you could connect to the SQL API Endpoint on Mongo API accounts but this endpoint is no longer accessible on accounts created with later versions of the Mongo API.

Even when this was possible your use case of reads using mongo client and writes using no sql would not have been supported.

The Mongo documents returned by the SQL end point were a SQL API JSON serialisation of the BSON documents (i.e. every original property in the BSON document was returned as a sub document with a type and value). This format was never documented.

As far as I know behind the scenes the documents are stored in this No SQL API format though and the Mongo API gateway performs a translation. This can be seen when collecting some of the diagnostic logs and also leaks in other ways (some of the Mongo commands get mapped to NoSQL API stored procedures so get capped by the 5 second bounded execution limit for example)

huangapple
  • 本文由 发表于 2023年5月26日 15:32:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76338579.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定