Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2345

Point out the two uses of update earlier in the docs

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • None
    • manual
    • None

    Description

      http://docs.mongodb.org/manual/reference/method/db.collection.update/

      Most people from an SQL background expect only the stated fields to be updated e.g.

      db.foo.update({_id: ObjectId(...)}, {a:1, b:1})

      would only modify fields a and b and leave the rest untouched.

      Suggest rewording the introduction to

      Modifies an existing document or documents in a collection. Can be used to either modify only specific fields, or to replace the document or documents entirely, depending on the update parameters passed.

      I think we need the hint at two use-cases right at the start as it is a very common mistake to accidentally wipe out an entire document doing an update incorrectly.

      (Users still may not read it and get into strife, but at least we tried)

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            joanna.cheng@mongodb.com Joanna Cheng
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 4 weeks ago