Chase AdamsChase Adams
AboutContentPromptsPrototypesNewsletter

update or add a property to subdocuments of all found documents (MongoDB)

Essays and updates on product, engineering, and AI by Chase Adams.

1 minute read

Post Details

Published
Sep 25, 2022
Category
Engineering
Share
ChatGPT

Latest Posts

A 2x2 Framework for Navigating AI Disruption

A 2x2 Framework for Navigating AI Disruption

Not all change requires the same response. A new framework for diagnosing which kind of disruption you're facing—and choosing the right strategy.

This updateMany finds all agreement_versions that has a participants property on it and sets each member (the $[] selects each individual member) of participants to have a field called role with a value of "Decider".

db.agreement_versions.updateMany(
  {
    participants: {
      $exists: true,
    },
  },
  {
    $set: {
      "participants.$[].role": "Decider",
    },
  }
);

AboutAI Workflow SpecContentStacksNewsletterPromptsRSS