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

change update() to be consistent with find()

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.6.0
    • Component/s: Usability
    • Labels:
      None
    • Environment:
      all
    • Query
    • Major Change

      How about changing update() to be consistent with find().

      Make update() by default affect all records matched, unless a limit() is supplied
      This allows the removal of update's currently optional "multi" argument.

      Furthermore, an updateOne() helper could be added, similar to findOne(). (Though not necessary, API symmetry can be nice.)

      Many new people get tripped up by missing the multi flag on update()--it's not the expected behavior. A self-consistent API is a usability win.

      Any code that specifies a unique _id for the criteria will not be affected. Most code that doesn't probably wants to affect all matching records anyways.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            nick@leippe.com Nick Leippe
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: