[英]Azure + Cosmos DB :
I use Azure and Cosmos DB to store some information, but I have some issues with a new collection I have created. 我使用Azure和Cosmos DB来存储一些信息,但是我创建的新集合存在一些问题。
I always go such kind of error message : 我总是走这样的错误信息:
Failed to update document 5b83e5297dfa952bb4036fa6: {"code":400,"body":"Command update failed: query in command must target a single shard key."}
无法更新文档5b83e5297dfa952bb4036fa6:{“代码”:400,“ body”:“命令更新失败:命令中的查询必须针对单个分片键。”}
The collection name is "item" and I try to store some images URLs. 集合名称为“ item”,我尝试存储一些图像URL。 So, I first try to add the following document
所以,我首先尝试添加以下文档
{
"_id" : ObjectId("5b83e5297dfa952bb4036fa6"),
"imageURL" : "https://www.tendance-parfums.com/media/resized/460/600/baseline-1/bgcolor-255-255-255/constrainonly-1/defaultimage-/keepaspectratio-1/keepframe-/mode-outer_resize/media/catalog/product/c/h/chanel-n5-eau-de-parfum-vaporisateur-y_2.jpg"
}
Notice that the _id
is created automatically. 请注意,
_id
是自动创建的。
So, I don't know why the Azure portal is always giving some errors! 因此,我不知道为什么Azure门户总是会出现一些错误!
Some details, the collection use the default parameters (Unlimited size), I use imageURL
as shard key, 15000 as throughput and item
as collection id. 一些细节,集合使用默认参数(大小不受限制),我使用
imageURL
作为分片键,使用15000作为吞吐量,使用item
作为集合ID。
Any idea? 任何想法?
PS: Another question is that it is looking for a shard key
when creating the collection, but for now I only have this field imageURL
, but I'm not sure it is suitable? PS:另一个问题是,在创建集合时它正在寻找一个分片
shard key
,但是现在我只有这个字段imageURL
,但是我不确定它是否合适?
我找到了一种解决方法,似乎分片键不能是URL,所以我使用了另一个复杂的键,它可以工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.