summaryrefslogtreecommitdiff
path: root/jstests/core/null2.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/null2.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/null2.js')
-rw-r--r--jstests/core/null2.js54
1 files changed, 24 insertions, 30 deletions
diff --git a/jstests/core/null2.js b/jstests/core/null2.js
index 841c26ac22f..0e8173bf874 100644
--- a/jstests/core/null2.js
+++ b/jstests/core/null2.js
@@ -2,44 +2,38 @@
t = db.null2;
t.drop();
-t.insert( { _id : 1, a : [ { b : 5 } ] } );
-t.insert( { _id : 2, a : [ {} ] } );
-t.insert( { _id : 3, a : [] } );
-t.insert( { _id : 4, a : [ {}, { b : 5 } ] } );
-t.insert( { _id : 5, a : [ 5, { b : 5 } ] } );
-
-function doQuery( query ) {
- printjson( query );
- t.find( query ).forEach(
- function(z) {
- print( "\t" + tojson(z) );
- }
- );
- return t.find( query ).count();
+t.insert({_id: 1, a: [{b: 5}]});
+t.insert({_id: 2, a: [{}]});
+t.insert({_id: 3, a: []});
+t.insert({_id: 4, a: [{}, {b: 5}]});
+t.insert({_id: 5, a: [5, {b: 5}]});
+
+function doQuery(query) {
+ printjson(query);
+ t.find(query).forEach(function(z) {
+ print("\t" + tojson(z));
+ });
+ return t.find(query).count();
}
-function getIds( query ) {
+function getIds(query) {
var ids = [];
- t.find( query ).forEach(
- function(z) {
- ids.push( z._id );
- }
- );
+ t.find(query).forEach(function(z) {
+ ids.push(z._id);
+ });
return ids;
}
-theQueries = [ { "a.b" : null }, { "a.b" : { $in : [ null ] } } ];
+theQueries = [{"a.b": null}, {"a.b": {$in: [null]}}];
-for ( var i=0; i < theQueries.length; i++ ) {
- assert.eq( 2, doQuery( theQueries[i] ) );
- assert.eq( [2,4], getIds( theQueries[i] ) );
+for (var i = 0; i < theQueries.length; i++) {
+ assert.eq(2, doQuery(theQueries[i]));
+ assert.eq([2, 4], getIds(theQueries[i]));
}
-t.ensureIndex( { "a.b" : 1 } );
+t.ensureIndex({"a.b": 1});
-for ( var i=0; i < theQueries.length; i++ ) {
- assert.eq( 2, doQuery( theQueries[i] ) );
- assert.eq( [2,4], getIds( theQueries[i] ) );
+for (var i = 0; i < theQueries.length; i++) {
+ assert.eq(2, doQuery(theQueries[i]));
+ assert.eq([2, 4], getIds(theQueries[i]));
}
-
-