Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2476

New $update atomic modifier for changing array elements

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Environment:
      All
    • Query
    • Fully Compatible

      The proposal: new $update atomic modifier to identify objects in an array using a query criteria and update them. I've tried to keep the syntax of this as close to update() as possible.

      $update:

      {field:[query, update, <upsert> ,<multi>]}

      In the update the following special tokens can be used:
      $$ the array denoted by "field", defining the scope of the operation.
      $ the current element identified by the query.

      This may or may not duplicate some of the virtual collections ticket: http://jira.mongodb.org/browse/SERVER-142 but that ticket doesn't really contain any more than an idea that clearly a lot of people like. I'm hoping that this ticket can start a discussion that can end up in a useful specification. Some examples to follow....

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            keithbranton Keith Branton
            Votes:
            10 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: