diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/null2.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-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.js | 54 |
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])); } - - |