通过REST api创建CosmoDb文档会导致通过mongodb客户端搜索集合时出错 [英] Creating CosmoDb documents via REST api results in errors when searching the collection via mongodb client

查看:77
本文介绍了通过REST api创建CosmoDb文档会导致通过mongodb客户端搜索集合时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Gmail加载项,允许我从我的帐户收集电子邮件,并通过CosmosDB REST Api将这些电子邮件上传到Azure Cosmos数据库。



现在,当我通过post请求创建文档时,我无法再从任何mongodb客户端搜索集合。我收到以下错误:

错误:错误:{
" _t" :" OKMongoResponse",
" ok" :0,
" code" :1,
" errmsg" :"处理此请求时出现未知服务器错误。",
" $ err" :"处理此请求时出现未知服务器错误。"
}

在我通过REST Api插入文档之后,只能通过Rest api获取文档列表。看来,与通过mongodb客户端存储的文档相比,REST Api以不同的方式存储文档。没有"$ t"和
没有"$ v"值已创建。


在下面的示例中,第一个文档是通过mongodb客户端创建的,第二个文档是通过其余的api创建的。

 {
" _rid":" SMJGALJeKZY =",
" Documents":[
{
" $ t":3,
" $ v":{
" _id":{
" $ t":7,
" $ v":" \\\\\ 0000f "A%£|h\\\œ×DA"
},
" id":{
" $ t":2,
" $ v":" replace_with_new_document_id"
}
},
" id":" NWM5ZjI3YzAyNWEzYTY2ODljZDdkMGUx",
" _rid":" SMJGALJeKZYBAAAAAAAAAA ==",
" _self" :" dbs / SMJGAA == / colls / SMJGALJeKZY = / docs / SMJGALJeKZYBAAAAAAAAAA == /" ;,
" _etag":" \" 5c008fa5-0000-0d00-0000-5c9f27c00000 \" ;",
" _attachments":" attachments /",
" _ts":1553934272
},
{
" id": " testmail",
" eml":" test",
" _rid":" SMJGALJeKZYDAAAAAAAAAA ==",
" _self":" dbs / SMJGAA == / colls / SMJGALJeKZY = / docs / SMJGALJeKZYDAAAAAAAAAA == /" ;,
" _etag":" \" 5c0071a9-0000-0d00-0000-5c9f2c140000 \"",
" _attachments& quot;:" attachments /" ;,
" _ts":1553935380
}
],
" _count":2
}





解决方案

感谢您提请我们注意,并感谢您详细详细说明此问题。我将在内部联系我,我会回复你。 


问候,


Mike


I am working on a Gmail Add-In that allows me to collect emails from my account and uploads these to an Azure Cosmos DB via the CosmosDB REST Api.

Now, when I create a document via the post request I can no longer search the collection from any mongodb client. I am getting the following error:

Error: error: {
	"_t" : "OKMongoResponse",
	"ok" : 0,
	"code" : 1,
	"errmsg" : "Unknown server error occurred when processing this request.",
	"$err" : "Unknown server error occurred when processing this request."
}

After I inserted a documents via the REST Api its only possible to get the list of documents via the Rest api. It seems, that the REST Api is storing documents in different way compared to documents stored via the mongodb client, e.g. no "$t" and no "$v" values are created.

In the following example, the first document has been created via the mongodb client and the second via the rest api.

{
    "_rid": "SMJGALJeKZY=",
    "Documents": [
        {
            "$t": 3,
            "$v": {
                "_id": {
                    "$t": 7,
                    "$v": "\\\u009f'À%£¦h\u009c×Ðá"
                },
                "id": {
                    "$t": 2,
                    "$v": "replace_with_new_document_id"
                }
            },
            "id": "NWM5ZjI3YzAyNWEzYTY2ODljZDdkMGUx",
            "_rid": "SMJGALJeKZYBAAAAAAAAAA==",
            "_self": "dbs/SMJGAA==/colls/SMJGALJeKZY=/docs/SMJGALJeKZYBAAAAAAAAAA==/",
            "_etag": "\"5c008fa5-0000-0d00-0000-5c9f27c00000\"",
            "_attachments": "attachments/",
            "_ts": 1553934272
        },
        {
            "id": "testmail",
            "eml": "test",
            "_rid": "SMJGALJeKZYDAAAAAAAAAA==",
            "_self": "dbs/SMJGAA==/colls/SMJGALJeKZY=/docs/SMJGALJeKZYDAAAAAAAAAA==/",
            "_etag": "\"5c0071a9-0000-0d00-0000-5c9f2c140000\"",
            "_attachments": "attachments/",
            "_ts": 1553935380
        }
    ],
    "_count": 2
}


解决方案

Thank for bringing this to our attention and thank you for detailing this issue so thoroughly. I am going to reach-out internally and I will get back to you. 

Regards,

Mike


这篇关于通过REST api创建CosmoDb文档会导致通过mongodb客户端搜索集合时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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