CosmosDB MongoAPI Update Aggregation pipeline support

Viewed 16

I'm trying to update multiple documents using aggregation pipeline updater. In MongoDb I can use following query:

db.locations.update({}, [{
   $replaceRoot: { newRoot: "$User" }
}], { multi: true })

Or any other variant of update like this.

db.collection.update({}, [{}])

However in CosmosDB this outputs following error:

{
    "message" : "write command failed: MongoError: Expected type object but found array.",
    "stack" : "script:1:78",
    "code" : 14
}

Does it mean it's still unsupported? I haven't seen anything mentioned in documentation about this not being supported because without this I have to load all documents in memory and do manipulation there which is extremely slow.

I did test this on MongoAPI version 4.0 and 4.2 with the same result.

0 Answers
Related