I need to send bulk patch requests in azure functions. I've read their very minimalistic documentation on a function called "bulk( )" and here's what I currently have
const response = await container.items.bulk([
{
operationType: "Patch",
id: "FOO-123",
partitionKey: "FOO-123",
resourceBody: {
"op": "add",
"path": "/payments/-",
"value": {bar: "foo"}
}
}
])
Here's the item I'm trying to manipulate in CosmosDB
{
"id": "FOO-123",
"code": "FOO-123",
"payments": [
{
"foo": "bar"
}
]
}
When logging "response" I get this
[ { statusCode: 400, requestCharge: 1 } ]