summaryrefslogtreecommitdiff
path: root/jstests/core/distinct4.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/distinct4.js')
-rw-r--r--jstests/core/distinct4.js77
1 files changed, 38 insertions, 39 deletions
diff --git a/jstests/core/distinct4.js b/jstests/core/distinct4.js
index 2723e947d2d..a66022ecbaa 100644
--- a/jstests/core/distinct4.js
+++ b/jstests/core/distinct4.js
@@ -1,55 +1,54 @@
// Vaildate input to distinct command. SERVER-12642
(function() {
- "use strict";
+"use strict";
- var t = db.distinct4;
+var t = db.distinct4;
- t.drop();
- t.save({a: null});
- t.save({a: 1});
- t.save({a: 1});
- t.save({a: 2});
- t.save({a: 3});
+t.drop();
+t.save({a: null});
+t.save({a: 1});
+t.save({a: 1});
+t.save({a: 2});
+t.save({a: 3});
- // first argument should be a string or error
+// first argument should be a string or error
- // from shell helper
- assert.throws(function() {
- t.distinct({a: 1});
- });
+// from shell helper
+assert.throws(function() {
+ t.distinct({a: 1});
+});
- // from command interface
- assert.commandFailedWithCode(t.runCommand("distinct", {"key": {a: 1}}),
- ErrorCodes.TypeMismatch);
+// from command interface
+assert.commandFailedWithCode(t.runCommand("distinct", {"key": {a: 1}}), ErrorCodes.TypeMismatch);
- // second argument should be a document or error
+// second argument should be a document or error
- // from shell helper
- assert.throws(function() {
- t.distinct('a', '1');
- });
+// from shell helper
+assert.throws(function() {
+ t.distinct('a', '1');
+});
- // from command interface
- assert.commandFailedWithCode(t.runCommand("distinct", {"key": "a", "query": "a"}),
- ErrorCodes.TypeMismatch);
+// from command interface
+assert.commandFailedWithCode(t.runCommand("distinct", {"key": "a", "query": "a"}),
+ ErrorCodes.TypeMismatch);
- // empty query clause should not cause error
+// empty query clause should not cause error
- // from shell helper
- var a = assert.doesNotThrow(function() {
- return t.distinct('a');
- });
- // [ null, 1, 2, 3 ]
- assert.eq(4, a.length, tojson(a));
- assert.contains(null, a);
- assert.contains(1, a);
- assert.contains(2, a);
- assert.contains(3, a);
+// from shell helper
+var a = assert.doesNotThrow(function() {
+ return t.distinct('a');
+});
+// [ null, 1, 2, 3 ]
+assert.eq(4, a.length, tojson(a));
+assert.contains(null, a);
+assert.contains(1, a);
+assert.contains(2, a);
+assert.contains(3, a);
- // from command interface
- assert.commandWorked(t.runCommand("distinct", {"key": "a"}));
+// from command interface
+assert.commandWorked(t.runCommand("distinct", {"key": "a"}));
- // embedded nulls are prohibited in the key field
- assert.commandFailedWithCode(t.runCommand("distinct", {"key": "a\0b"}), 31032);
+// embedded nulls are prohibited in the key field
+assert.commandFailedWithCode(t.runCommand("distinct", {"key": "a\0b"}), 31032);
})();