JavaScript $function in update

XMLWordPrintableJSON

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

      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: