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

shell bulk API replaceOne behaves like updateOne

    • Server Development Platform
    • ALL
    • Hide

      The following code should fail but instead it updates the

      {a:0}

      document.

      var coll = db.foo;
      var batch = coll.initializeOrderedBulkOp();
      batch.insert({a:0});
      batch.find({a:0}).replaceOne({$set: {b:2}});
      var result = batch.execute();
      
      Show
      The following code should fail but instead it updates the {a:0} document. var coll = db.foo; var batch = coll.initializeOrderedBulkOp(); batch.insert({a:0}); batch.find({a:0}).replaceOne({$set: {b:2}}); var result = batch.execute();
    • Build A (10/09/15), Build B (10/30/15)

      According to the fluent API spec https://github.com/10gen/specifications/blob/master/source/driver-fluent-api.rst

      replaceOne should always replace and never update a document. This should be ensured by checking that the new document is not prefixed with '$'.

      This is currently not enforced in the shell bulk API implementation. replaceOne calls updateOne directly without any extra checks.

            Assignee:
            backlog-server-devplatform [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
            Reporter:
            andreas.nilsson Andreas Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: