diff options
-rw-r--r-- | jstests/core/profile_update.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/jstests/core/profile_update.js b/jstests/core/profile_update.js index 23478df4149..454bb5c22ed 100644 --- a/jstests/core/profile_update.js +++ b/jstests/core/profile_update.js @@ -69,8 +69,9 @@ } assert.commandWorked(coll.createIndex({a: 1})); - coll.update({_id: "new value", a: 4}, {$inc: {b: 1}}, {upsert: true}); + assert.writeOK(coll.update({_id: "new value", a: 4}, {$inc: {b: 1}}, {upsert: true})); profileObj = getLatestProfilerEntry(testDB); + assert.eq(profileObj.query, {_id: "new value", a: 4}, tojson(profileObj)); assert.eq(profileObj.updateobj, {$inc: {b: 1}}, tojson(profileObj)); assert.eq(profileObj.keysExamined, 0, tojson(profileObj)); @@ -81,6 +82,23 @@ assert.eq(profileObj.upsert, true, tojson(profileObj)); // + // Confirm 'nmoved' for MMAPv1. + // + if (db.serverStatus().storageEngine.name === "mmapv1") { + coll.drop(); + assert.writeOK(coll.insert({_id: 1})); + + assert.writeOK(coll.update({_id: 1}, {$set: {b: new Array(128).toString()}})); + profileObj = getLatestProfilerEntry(testDB); + + assert.eq(profileObj.keysInserted, 1, tojson(profileObj)); + assert.eq(profileObj.keysDeleted, 1, tojson(profileObj)); + assert.eq(profileObj.nMatched, 1, tojson(profileObj)); + assert.eq(profileObj.nModified, 1, tojson(profileObj)); + assert.eq(profileObj.nmoved, 1, tojson(profileObj)); + } + + // // Confirm "fromMultiPlanner" metric. // coll.drop(); @@ -94,4 +112,4 @@ profileObj = getLatestProfilerEntry(testDB); assert.eq(profileObj.fromMultiPlanner, true, tojson(profileObj)); -})();
\ No newline at end of file +})(); |