我正在使用带有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聚合方法不起作用
发布评论