summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/apply_ops_errors.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod/apply_ops_errors.js')
-rw-r--r--jstests/noPassthroughWithMongod/apply_ops_errors.js55
1 files changed, 14 insertions, 41 deletions
diff --git a/jstests/noPassthroughWithMongod/apply_ops_errors.js b/jstests/noPassthroughWithMongod/apply_ops_errors.js
index 8cc5a8ad4cb..31353523810 100644
--- a/jstests/noPassthroughWithMongod/apply_ops_errors.js
+++ b/jstests/noPassthroughWithMongod/apply_ops_errors.js
@@ -19,19 +19,11 @@
// Scenario 1: only one operation
assert.eq(0, coll.find().count(), "test collection not empty");
- coll.ensureIndex({x:1},{unique:true});
- coll.insert({ _id: 1, x: "init" });
+ coll.ensureIndex({x: 1}, {unique: true});
+ coll.insert({_id: 1, x: "init"});
- var res = db.runCommand({ applyOps: [
- {
- op: "i",
- ns: coll.getFullName(),
- o: {
- _id: 2,
- x: "init"
- }
- },
- ]});
+ var res =
+ db.runCommand({applyOps: [{op: "i", ns: coll.getFullName(), o: {_id: 2, x: "init"}}, ]});
assert.eq(1, res.applied);
assert(res.code);
@@ -43,35 +35,16 @@
// Scenario 2: Three operations, first two should run, second should fail.
assert.eq(0, coll.find().count(), "test collection not empty");
- coll.ensureIndex({x:1},{unique:true});
- coll.insert({ _id: 1, x: "init" });
-
- var res = db.runCommand({ applyOps: [
- {
- op: "i",
- ns: coll.getFullName(),
- o: {
- _id: 3,
- x: "not init"
- }
- },
- {
- op: "i",
- ns: coll.getFullName(),
- o: {
- _id: 4,
- x: "init"
- }
- },
- {
- op: "i",
- ns: coll.getFullName(),
- o: {
- _id: 5,
- x: "not init again"
- }
- },
- ]});
+ coll.ensureIndex({x: 1}, {unique: true});
+ coll.insert({_id: 1, x: "init"});
+
+ var res = db.runCommand({
+ applyOps: [
+ {op: "i", ns: coll.getFullName(), o: {_id: 3, x: "not init"}},
+ {op: "i", ns: coll.getFullName(), o: {_id: 4, x: "init"}},
+ {op: "i", ns: coll.getFullName(), o: {_id: 5, x: "not init again"}},
+ ]
+ });
assert.eq(2, res.applied);
assert(res.code);