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

findAndModify return value changes upon error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.8.0-rc2
    • Component/s: Querying
    • None
    • Minor Change
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Note, this issue is with 2.8.0-rc3-pre, not with rc2, but JIRA wouldn't let me fill in 2.8.0-rc3-pre

      The following code:

          $retval = $col->findAndModify(
               array("inprogress" => false, "name" => "Biz report"),
               array('$set' => array('$set' => array('inprogress' => true, "started" => new MongoDate()))),
               null,
               array(
                  "sort" => array("priority" => -1),
                  "new" => true,
              )
          );
      

      Returns this with rc2:

      string(9) "2.8.0-rc2"
      exception message: localhost:30000: The dollar ($) prefixed field '$set' in '$set' is not valid for storage.
      exception code: 2
      array(3) {
        'lastErrorObject' =>
        array(5) {
          'connectionId' =>
          int(3)
          'err' =>
          string(72) "The dollar ($) prefixed field '$set' in '$set' is not valid for storage."
          'code' =>
          int(52)
          'n' =>
          int(0)
          'ok' =>
          double(1)
        }
        'ok' =>
        double(0)
        'errmsg' =>
        string(72) "The dollar ($) prefixed field '$set' in '$set' is not valid for storage."
      }
      

      But in the latest master build, it is suddenly:

      string(14) "2.8.0-rc3-pre-"
      exception message: localhost:30000: exception: The dollar ($) prefixed field '$set' in '$set' is not valid for storage.
      exception code: 52
      array(3) {
        'errmsg' =>
        string(83) "exception: The dollar ($) prefixed field '$set' in '$set' is not valid for storage."
        'code' =>
        int(52)
        'ok' =>
        double(0)
      }
      

      It doesn't seem to break any code... but it did trip up a test case for us. As I couldn't find a reference to this (slightly) BC breaking change, I am filing this issue.

            Assignee:
            Unassigned Unassigned
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: