我可以 POST 向 RavenDB 的 /bulk_docs HTTP API 端点发送多个补丁请求吗?

Can I POST multiple patch requests to RavenDB's /bulk_docs HTTP API endpoint?

我正在为 RavenDB 编写节点包装器。

我使用的是版本 3,但由于没有 HTTP 文档,我一直依赖 2.0 和 2.5 文档。

关于单个文档操作,我已经 this doc page 成功地对单个文档进行 PUT、DELETE 和多个 PATCH。

类似地,我已经 this doc page 在一次 HTTP 调用中成功地对多个文档进行了多次 PUT 和 DELETE 但是文档在一次调用中 PATCHing 多个文档方面有点含糊.

在 "Batching Requests" 标题下,它清楚地表明这是可能的:

Request batching in RavenDB is handled using the '/bulk_docs' endpoint, which accepts an array of operations to execute. The format for the operations is:

method - PUT, PATCH or DELETE.

...

对于 PUT,我 POST 到 /bulk_docs:

[
  {
    Method: 'PUT',
    Key: 'users/1',
    Document: { username: 'dummy' }
    Metadata: { 'Raven-Entity-Type': 'Users' }
  },
  ...
]

对于 DELETE,我 POST 到 /bulk_docs:

[
  {
    Method: 'DELETE',
    Key: 'users/1'
  },
  ...
]

对于 PATCH,我已经尝试 POST 了以下但没有成功:

[
  {
    Method: 'PATCH',
    Key: 'users/1',
    Document: {
      Type: 'Set',
      Name:'username',
      Value: 'new-username'
    }
  },
  ...
]

[
  {
    Method: 'PATCH',
    Key: 'users/1',
    Type: 'Set',
    Name:'username',
    Value: 'new-username'
  },
  ...
]

我得到的只是 500 - Internal Server Error 并且没有在该文档页面上修补多个文档的任何示例,我有点卡住了...

任何帮助将不胜感激:)

PATCH 的结构是:

[
  {
    Method: 'PATCH',
    Key: 'users/1',
    Patches: [{
Type: 'Set',
        Name:'username',
        Value: 'new-username'
}]
  },
  ...
]

完整的结构可以在这里看到: https://github.com/ayende/ravendb/blob/master/Raven.Abstractions/Commands/PatchCommandData.cs#L72