Skip to content

Instantly share code, notes, and snippets.

@peterjasc
peterjasc / updateMultiple
Last active August 4, 2021 10:36
Mongo Update array inside an array. Nested arrays
db.Appointment.update(
{ "history": {$exists:true} },
[{
$set: {
history: {
$map: {
input: "$history",
in: {
$cond: [
{ $ne: ["$$this.changedBy", null] },

Keybase proof

I hereby claim:

  • I am peterjasc on github.
  • I am peterjasc (https://keybase.io/peterjasc) on keybase.
  • I have a public key ASDLydAl9tOAwejED0uzl7I9VD4-HheAyZjtwmbokvR47Ao

To claim this, I am signing this object: