Cosmosdb MongoDB API聚合方法不起作用

编程入门 行业动态 更新时间:2024-10-24 12:22:20
本文介绍了Cosmosdb MongoDB API聚合方法不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用带有MongoDB API的Cosmos DB 和 当我使用聚合管道对文档进行计数时,结果不正确且不稳定.

实际上,我比较了"aggregate()"与"find()"一起使用并且即使两个查询都是相同的,这些结果也根本不匹配.

环境信息:

*使用分片(分区数据)

* MongoDB聚合管道已启用

* MongoDB 3.4写入协议(版本 5)

例如

1. find()的结果.

find()方法可正确检索文档.

db.datastore.find({header_channel_id:" bckr419gqoomm42jlsng}).limit(1) {"_id" :"object-bckr61jfuq8jml2nu950","header_channel_id"; :"bckr419gqoomm42jlsng","header_channel_protocols"; :[],"header_session_id"; :"session-xyz","header_timestamp"; :NumberLong(1),"header_mimetype"; :"text/plain","location_latitude"; :null,"location_longitude"; :null,"location_altitude"; :null,"created_at" :NumberLong("1529459462968360566"),有效负载" :BinData(0,"aG9nZQ =="),"payload_size"; :NumberLong(4)}

解决方案

您好TianzHong9045,

"我们现在正处于MongoDB聚合管道的公开预览中.您可以在Azure Portal中的Cosmos DB MongoDB API帐户的预览功能"页面上启用它.此处描述了受支持的语法构造:aka.ms/mongodb-feature-support"

汇总管道 如果仍然存在异常,可以请您导航至以下文档,并根据所声明的内容确认语法: MongoDB API对MongoDB功能和语法的支持

谢谢

迈克

I am using Cosmos DB with MongoDB APIand when I use aggregation pipeline to count documents, the results are incorrect and unstable.

Actually I compared "aggregate()" with "find()" and these results didn't match at all even the both queries are equivalent.

Environment info:

* using sharding (partition data)

*MongoDB Aggregation Pipeline is enabled

*MongoDB 3.4 write protocol(version 5)

For instance

1. the result of find() .

find() method retrieved a document correctly.

db.datastore.find({header_channel_id:"bckr419gqoomm42jlsng"}).limit(1) { "_id" : "object-bckr61jfuq8jml2nu950", "header_channel_id" : "bckr419gqoomm42jlsng", "header_channel_protocols" : [ ], "header_session_id" : "session-xyz", "header_timestamp" : NumberLong(1), "header_mimetype" : "text/plain", "location_latitude" : null, "location_longitude" : null, "location_altitude" : null, "created_at" : NumberLong("1529459462968360566"), "payload" : BinData(0,"aG9nZQ=="), "payload_size" : NumberLong(4) }

解决方案

Hi TianzHong9045,

"We are now in public preview with MongoDB aggregation pipeline. You can enable it on Preview Features page for your Cosmos DB MongoDB API account in Azure Portal. The supported syntax constructs are described here: aka.ms/mongodb-feature-support"

Aggregation Pipeline

If there are still anomalies, can you please navigate to the below documentation and confirm your syntax against what is stated: MongoDB API support for MongoDB features and syntax

Thanks,

Mike

更多推荐

Cosmosdb MongoDB API聚合方法不起作用

本文发布于:2023-11-22 13:06:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1617530.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   方法   Cosmosdb   MongoDB   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!