mongoDB updateMany bug

Using the following command in the Mongo shell updates the records field of all documents to the number of elements in history field array of that document:

db.auditlogInvoice.updateMany({},[{$set: {records: { $size: "$history" }}}])

However via a workflow step in retool:
Screenshot 2024-09-09 at 16.38.10

It instead creates an object:
"records": {
"$size": "$history"
}

So it is taking the literal string rather than the $size command.

Any ideas why if it's my end please? M0 Atlas Cloud cluster, Retool Cloud hosted version 3.89.0

Hi @mawdo81! I think you just need to wrap all of the "Update" operations in an array - [{$set: {records: {$size: "$history"}}}] - just like you do when updating via the shell. The placeholder text in Retool is a tiny bit misleading in this case. Hope that helps!