邮递员:无法使用Azure MongoDB API创建文档

邮递员:无法使用Azure MongoDB API创建文档,azure,azure-cosmosdb,azure-cosmosdb-mongoapi,Azure,Azure Cosmosdb,Azure Cosmosdb Mongoapi,在使用创建文档时,我面临以下参数不同的问题 在创建集合UserProfile时,我使用分区键username创建了它 Request1:-没有分区密钥 标题: x-ms-documentdb-is-upsert: true x-ms-documentdb-is-upsert: true x-ms-documentdb-partitionkey: ["username"] x-ms-documentdb-is-upsert: true x-ms-documentdb-partitionkey:

在使用创建文档时,我面临以下参数不同的问题

在创建集合UserProfile时,我使用分区键username创建了它

Request1:-没有分区密钥

标题:

x-ms-documentdb-is-upsert: true
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
正文:

问题:

x-ms-partitionkey标头中提供的分区密钥具有较少的 组件,而不是集合中定义的组件

请求2:-具有分区密钥

标题:

x-ms-documentdb-is-upsert: true
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
正文:

问题:

指定的输入之一无效

Request3:-在正文中指定了分区键和id

标题:

x-ms-documentdb-is-upsert: true
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
正文:

问题:

从文档中提取的PartitionKey与指定的不匹配 在标题中

无论如何

我无法创建文档。创建具有指定分区的文档所需的参数有哪些?

两点:

如果您使用的是Mongo API,则不应使用REST API。虽然在技术上是可行的,但不支持同时使用两者。100%不推荐

分区键需要是分区键值,而不是路径本身,因此它应该是test,而不是username。它已经知道用户名是路径

两点:

如果您使用的是Mongo API,则不应使用REST API。虽然在技术上是可行的,但不支持同时使用两者。100%不推荐

分区键需要是分区键值,而不是路径本身,因此它应该是test,而不是username。它已经知道用户名是路径