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

JavaScript $function in update

    • 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
    • Labels:
    • Query

      For maximum flexibility we should allow running arbitrary javascript code on each object during an update. It should probably run after other modifiers.

      update({_id: "foo"}. {$inc:

      {count: 1, total: 5}

      , $function: function()

      {this.avg = this.total / this.count}

      }

            Created:
            Updated:
            Resolved: