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

Extend update command to perform per-operation validation

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Write Ops
    • Query

      Currently all validation settings exist in collection options, so they apply to all updates and inserts collection-wide.
      It would be useful to have the ability to specify a validation condition per-op, so that rules that have parameters based on the context of the op can be used as part of the validation rule.

      There is no way to do this client side, because the client can not know the result of applying the update modifiers.

      example:

      db.runCommand({"update",
        {updates:  [
          q: { user: "bobby.tables" }, 
          u: { $inc: {score:100} } , 
          upsert : false, 
          multi: true, 
          validator: { score: {$lt: team.score_limit } }
         ]}
      });
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            mikeo@mongodb.com Michael O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: