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

Syntax change in findAndModify now requires explicit use of query, remove, update

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Critical - P2 Critical - P2
    • None
    • v1.0
    • None
    • None

    Description

      2.0.7:

      > db.test.findAndModify({"_accountId" : "100000057408993"}, {"$unset": {"gifts.5c06e45d229c4ed5800a26f1b66bde4a":true}});
      null

      2.2.0:

      > db.test.findAndModify({"_accountId" : "100000057408993"}, {"$unset": {"gifts.5c06e45d229c4ed5800a26f1b66bde4a":true}});
      Wed Sep 26 19:06:04 uncaught exception: findAndModifyFailed failed: {
        "errmsg": "need remove or update",
        "ok": 0
      }

      Need to change the command to explicitly use the query and update documents. This was changed with SERVER-1117.

      2.2.0:

      > db.test.findAndModify( {query:{"_accountId" : "100000057408993"}, update:{"$unset": {"gifts.5c06e45d229c4ed5800a26f1b66bde4a":true}}});

      Attachments

        Activity

          People

            epc Ed Costello
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 20 weeks, 6 days ago