Open tomosterlund opened 3 years ago
Just ran into this earlier as well.
Your array structure doesn't need the "filter" or "update" keys, try just sending the variables themselves.
$singleOperationQuery = [
'updateOne' => [
['_id' => $key],
['$set' => $userUpdatedModel]
]
];
Also, if you're gonna do a "replaceOne" instead, you just send the document you're replacing w/out "replacement" or "$set" keys.
Description:
In a Laravel project that I'm working on, we now have a use case where we would like to access the MongoDB bulkWrite() operation, in order to iterate over objects that users have updated, and create multiple updateOne-Operations to send off to MongoDB, all in one request - see https://docs.mongodb.com/manual/core/bulk-write-operations/
The query is built as following:
And we then try to send it off to the DB like:
Error message
On this we receive the following error message: Missing first argument for $operations[0][\"updateOne\"]
Is bulkWrite() not supported, or am I missing out on something obvious here?