summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Grundy <michael.grundy@10gen.com>2016-02-04 12:29:01 -0500
committerMike Grundy <michael.grundy@10gen.com>2016-02-09 13:41:02 -0500
commit3bed8596d18275d1561e4f44f1f0bd72c1e038f1 (patch)
tree788eaed3c7a692a424f080d16a8841dc8afa3c13
parent985e2a0be95709ac064c57f0a9bb385a55937285 (diff)
downloadmongo-3bed8596d18275d1561e4f44f1f0bd72c1e038f1.tar.gz
SERVER-22341 fix jslint errors in jstests/core with eslint --fix
Conflicts: jstests/core/count_hint.js
-rw-r--r--jstests/core/all.js2
-rw-r--r--jstests/core/all2.js16
-rw-r--r--jstests/core/and.js6
-rw-r--r--jstests/core/andor.js4
-rw-r--r--jstests/core/apitest_db.js10
-rw-r--r--jstests/core/array1.js4
-rw-r--r--jstests/core/array3.js10
-rw-r--r--jstests/core/array_match1.js22
-rw-r--r--jstests/core/arrayfind1.js12
-rw-r--r--jstests/core/arrayfind2.js10
-rw-r--r--jstests/core/arrayfind3.js16
-rw-r--r--jstests/core/auth1.js10
-rw-r--r--jstests/core/auth2.js4
-rw-r--r--jstests/core/basic3.js18
-rw-r--r--jstests/core/basic7.js2
-rw-r--r--jstests/core/basic9.js6
-rw-r--r--jstests/core/batch_write_command_delete.js4
-rw-r--r--jstests/core/batch_write_command_insert.js4
-rw-r--r--jstests/core/batch_write_command_update.js12
-rw-r--r--jstests/core/bench_test1.js12
-rw-r--r--jstests/core/bench_test2.js26
-rw-r--r--jstests/core/bench_test3.js14
-rw-r--r--jstests/core/big_object1.js24
-rw-r--r--jstests/core/bulk_api_ordered.js6
-rw-r--r--jstests/core/bulk_api_unordered.js6
-rw-r--r--jstests/core/bulk_insert.js18
-rw-r--r--jstests/core/capped1.js4
-rw-r--r--jstests/core/capped5.js10
-rw-r--r--jstests/core/capped6.js4
-rw-r--r--jstests/core/capped9.js14
-rw-r--r--jstests/core/capped_empty.js2
-rw-r--r--jstests/core/capped_update.js2
-rw-r--r--jstests/core/cappeda.js20
-rw-r--r--jstests/core/check_shard_index.js8
-rw-r--r--jstests/core/collmod.js10
-rw-r--r--jstests/core/compact_keeps_indexes.js2
-rw-r--r--jstests/core/connection_string_validation.js2
-rw-r--r--jstests/core/constructors.js38
-rw-r--r--jstests/core/count2.js24
-rw-r--r--jstests/core/count4.js2
-rw-r--r--jstests/core/counta.js6
-rw-r--r--jstests/core/coveredIndex1.js22
-rw-r--r--jstests/core/coveredIndex2.js6
-rw-r--r--jstests/core/covered_index_compound_1.js38
-rw-r--r--jstests/core/covered_index_negative_1.js40
-rw-r--r--jstests/core/covered_index_simple_1.js48
-rw-r--r--jstests/core/covered_index_simple_2.js32
-rw-r--r--jstests/core/covered_index_simple_3.js34
-rw-r--r--jstests/core/covered_index_simple_id.js38
-rw-r--r--jstests/core/covered_index_sort_1.js32
-rw-r--r--jstests/core/covered_index_sort_2.js18
-rw-r--r--jstests/core/covered_index_sort_3.js16
-rw-r--r--jstests/core/create_indexes.js6
-rw-r--r--jstests/core/crud_api.js10
-rw-r--r--jstests/core/currentop.js10
-rw-r--r--jstests/core/cursor1.js2
-rw-r--r--jstests/core/cursor3.js22
-rw-r--r--jstests/core/cursora.js24
-rw-r--r--jstests/core/cursorb.js2
-rw-r--r--jstests/core/datasize2.js8
-rw-r--r--jstests/core/date1.js10
-rw-r--r--jstests/core/date3.js44
-rw-r--r--jstests/core/dbadmin.js18
-rw-r--r--jstests/core/dbcase.js4
-rw-r--r--jstests/core/dbcase2.js4
-rw-r--r--jstests/core/delx.js16
-rw-r--r--jstests/core/depth_limit.js4
-rw-r--r--jstests/core/distinct1.js12
-rw-r--r--jstests/core/distinct2.js2
-rw-r--r--jstests/core/distinct_array1.js18
-rw-r--r--jstests/core/distinct_index1.js42
-rw-r--r--jstests/core/distinct_index2.js22
-rw-r--r--jstests/core/distinct_speed1.js2
-rw-r--r--jstests/core/drop3.js2
-rw-r--r--jstests/core/drop_index.js2
-rw-r--r--jstests/core/elemMatchProjection.js10
-rw-r--r--jstests/core/error2.js2
-rw-r--r--jstests/core/error5.js6
-rw-r--r--jstests/core/eval1.js2
-rw-r--r--jstests/core/eval7.js4
-rw-r--r--jstests/core/eval8.js2
-rw-r--r--jstests/core/eval9.js2
-rw-r--r--jstests/core/eval_nolock.js4
-rw-r--r--jstests/core/evala.js4
-rw-r--r--jstests/core/evalc.js12
-rw-r--r--jstests/core/evald.js2
-rw-r--r--jstests/core/evale.js2
-rw-r--r--jstests/core/exists.js12
-rw-r--r--jstests/core/exists2.js6
-rw-r--r--jstests/core/exists3.js2
-rw-r--r--jstests/core/existsa.js4
-rw-r--r--jstests/core/explain3.js2
-rw-r--r--jstests/core/explain_batch_size.js2
-rw-r--r--jstests/core/filemd5.js8
-rw-r--r--jstests/core/find1.js4
-rw-r--r--jstests/core/find4.js4
-rw-r--r--jstests/core/find5.js2
-rw-r--r--jstests/core/find6.js4
-rw-r--r--jstests/core/find_and_modify3.js4
-rw-r--r--jstests/core/find_and_modify_concurrent_update.js2
-rw-r--r--jstests/core/find_and_modify_empty_coll.js2
-rw-r--r--jstests/core/find_and_modify_server6226.js4
-rw-r--r--jstests/core/find_and_modify_server6254.js8
-rw-r--r--jstests/core/find_and_modify_server6582.js18
-rw-r--r--jstests/core/find_and_modify_server6588.js30
-rw-r--r--jstests/core/find_and_modify_server6659.js2
-rw-r--r--jstests/core/find_and_modify_server7660.js2
-rw-r--r--jstests/core/find_and_modify_where.js4
-rw-r--r--jstests/core/fm1.js2
-rw-r--r--jstests/core/fm2.js4
-rw-r--r--jstests/core/fm3.js2
-rw-r--r--jstests/core/fm4.js14
-rw-r--r--jstests/core/fts1.js4
-rw-r--r--jstests/core/fts_casesensitive.js2
-rw-r--r--jstests/core/fts_mix.js2
-rw-r--r--jstests/core/fts_partition1.js2
-rw-r--r--jstests/core/fts_partition_no_multikey.js2
-rw-r--r--jstests/core/fts_phrase.js2
-rw-r--r--jstests/core/fts_querylang.js4
-rw-r--r--jstests/core/geo1.js14
-rw-r--r--jstests/core/geo10.js6
-rw-r--r--jstests/core/geo2.js16
-rw-r--r--jstests/core/geo3.js42
-rw-r--r--jstests/core/geo5.js10
-rw-r--r--jstests/core/geo6.js22
-rw-r--r--jstests/core/geo7.js14
-rw-r--r--jstests/core/geo9.js26
-rw-r--r--jstests/core/geo_2d_explain.js4
-rw-r--r--jstests/core/geo_allowedcomparisons.js40
-rw-r--r--jstests/core/geo_array0.js12
-rw-r--r--jstests/core/geo_array1.js18
-rw-r--r--jstests/core/geo_array2.js94
-rw-r--r--jstests/core/geo_borders.js34
-rw-r--r--jstests/core/geo_box1.js24
-rw-r--r--jstests/core/geo_box1_noindex.js24
-rw-r--r--jstests/core/geo_box2.js8
-rw-r--r--jstests/core/geo_center_sphere1.js26
-rw-r--r--jstests/core/geo_center_sphere2.js4
-rw-r--r--jstests/core/geo_circle1.js6
-rw-r--r--jstests/core/geo_circle1_noindex.js6
-rw-r--r--jstests/core/geo_circle2.js2
-rw-r--r--jstests/core/geo_circle2a.js34
-rw-r--r--jstests/core/geo_circle3.js26
-rw-r--r--jstests/core/geo_circle4.js8
-rw-r--r--jstests/core/geo_circle5.js16
-rw-r--r--jstests/core/geo_exactfetch.js14
-rw-r--r--jstests/core/geo_fiddly_box.js32
-rw-r--r--jstests/core/geo_fiddly_box2.js42
-rw-r--r--jstests/core/geo_group.js4
-rw-r--r--jstests/core/geo_haystack1.js18
-rw-r--r--jstests/core/geo_haystack2.js18
-rw-r--r--jstests/core/geo_haystack3.js20
-rw-r--r--jstests/core/geo_mapreduce.js4
-rw-r--r--jstests/core/geo_mapreduce2.js22
-rw-r--r--jstests/core/geo_max.js54
-rw-r--r--jstests/core/geo_multinest0.js20
-rw-r--r--jstests/core/geo_multinest1.js16
-rw-r--r--jstests/core/geo_near_random2.js2
-rw-r--r--jstests/core/geo_nearwithin.js28
-rw-r--r--jstests/core/geo_oob_sphere.js28
-rw-r--r--jstests/core/geo_or.js4
-rw-r--r--jstests/core/geo_poly_edge.js18
-rw-r--r--jstests/core/geo_poly_line.js14
-rw-r--r--jstests/core/geo_polygon1.js28
-rw-r--r--jstests/core/geo_polygon1_noindex.js8
-rw-r--r--jstests/core/geo_polygon2.js6
-rw-r--r--jstests/core/geo_polygon3.js6
-rw-r--r--jstests/core/geo_queryoptimizer.js30
-rw-r--r--jstests/core/geo_regex0.js20
-rw-r--r--jstests/core/geo_s2cursorlimitskip.js16
-rw-r--r--jstests/core/geo_s2dedupnear.js14
-rw-r--r--jstests/core/geo_s2descindex.js8
-rw-r--r--jstests/core/geo_s2disjoint_holes.js2
-rw-r--r--jstests/core/geo_s2dupe_points.js6
-rwxr-xr-xjstests/core/geo_s2edgecases.js36
-rw-r--r--jstests/core/geo_s2exact.js26
-rw-r--r--jstests/core/geo_s2holesameasshell.js6
-rwxr-xr-xjstests/core/geo_s2index.js70
-rwxr-xr-xjstests/core/geo_s2indexoldformat.js20
-rw-r--r--jstests/core/geo_s2intersection.js12
-rw-r--r--jstests/core/geo_s2largewithin.js6
-rw-r--r--jstests/core/geo_s2meridian.js2
-rw-r--r--jstests/core/geo_s2multi.js14
-rw-r--r--jstests/core/geo_s2near.js88
-rw-r--r--jstests/core/geo_s2nearComplex.js76
-rw-r--r--jstests/core/geo_s2nearcorrect.js6
-rw-r--r--jstests/core/geo_s2nearwithin.js30
-rw-r--r--jstests/core/geo_s2nongeoarray.js10
-rwxr-xr-xjstests/core/geo_s2nonstring.js6
-rw-r--r--jstests/core/geo_s2nopoints.js8
-rw-r--r--jstests/core/geo_s2oddshapes.js12
-rw-r--r--jstests/core/geo_s2ordering.js16
-rw-r--r--jstests/core/geo_s2overlappingpolys.js6
-rwxr-xr-xjstests/core/geo_s2polywithholes.js4
-rw-r--r--jstests/core/geo_s2sparse.js2
-rw-r--r--jstests/core/geo_s2twofields.js4
-rw-r--r--jstests/core/geo_s2within.js36
-rw-r--r--jstests/core/geo_sort1.js8
-rw-r--r--jstests/core/geo_uniqueDocs.js52
-rw-r--r--jstests/core/geo_uniqueDocs2.js2
-rw-r--r--jstests/core/geo_update.js24
-rw-r--r--jstests/core/geo_update1.js18
-rw-r--r--jstests/core/geo_update2.js18
-rw-r--r--jstests/core/geo_update_btree.js10
-rw-r--r--jstests/core/geo_update_btree2.js48
-rw-r--r--jstests/core/geo_update_dedup.js8
-rw-r--r--jstests/core/geo_withinquery.js6
-rw-r--r--jstests/core/geoa.js8
-rw-r--r--jstests/core/geoc.js10
-rw-r--r--jstests/core/geod.js14
-rw-r--r--jstests/core/geof.js16
-rw-r--r--jstests/core/getlog1.js6
-rw-r--r--jstests/core/getlog2.js4
-rw-r--r--jstests/core/group1.js14
-rw-r--r--jstests/core/group2.js4
-rw-r--r--jstests/core/group4.js18
-rw-r--r--jstests/core/group5.js2
-rw-r--r--jstests/core/grow_hash_table.js2
-rw-r--r--jstests/core/hashindex1.js2
-rw-r--r--jstests/core/id1.js2
-rw-r--r--jstests/core/idhack.js34
-rw-r--r--jstests/core/in5.js22
-rw-r--r--jstests/core/inc-SERVER-7446.js4
-rw-r--r--jstests/core/inc2.js2
-rw-r--r--jstests/core/inc3.js4
-rw-r--r--jstests/core/index13.js6
-rw-r--r--jstests/core/index8.js2
-rw-r--r--jstests/core/indexOtherNamespace.js2
-rw-r--r--jstests/core/index_arr1.js22
-rw-r--r--jstests/core/index_arr2.js8
-rw-r--r--jstests/core/index_big1.js2
-rwxr-xr-xjstests/core/index_bigkeys.js2
-rw-r--r--jstests/core/index_check2.js2
-rw-r--r--jstests/core/index_check5.js2
-rw-r--r--jstests/core/index_check7.js14
-rw-r--r--jstests/core/index_create_with_nul_in_name.js2
-rw-r--r--jstests/core/index_diag.js28
-rw-r--r--jstests/core/index_elemmatch1.js20
-rw-r--r--jstests/core/index_many2.js22
-rw-r--r--jstests/core/index_sparse1.js58
-rw-r--r--jstests/core/index_sparse2.js30
-rw-r--r--jstests/core/index_stats.js8
-rw-r--r--jstests/core/indexa.js2
-rw-r--r--jstests/core/indexf.js2
-rw-r--r--jstests/core/indexg.js2
-rw-r--r--jstests/core/indexl.js6
-rw-r--r--jstests/core/indexm.js2
-rw-r--r--jstests/core/indexn.js4
-rw-r--r--jstests/core/insert1.js2
-rw-r--r--jstests/core/insert2.js4
-rw-r--r--jstests/core/js2.js2
-rw-r--r--jstests/core/js3.js4
-rw-r--r--jstests/core/js4.js4
-rw-r--r--jstests/core/js5.js6
-rw-r--r--jstests/core/js9.js2
-rw-r--r--jstests/core/json1.js4
-rw-r--r--jstests/core/kill_cursors.js2
-rw-r--r--jstests/core/killop.js2
-rw-r--r--jstests/core/loadserverscripts.js2
-rw-r--r--jstests/core/loglong.js14
-rw-r--r--jstests/core/logprocessdetails.js4
-rw-r--r--jstests/core/map1.js12
-rw-r--r--jstests/core/maxscan.js12
-rw-r--r--jstests/core/minmax.js12
-rw-r--r--jstests/core/mr1.js2
-rw-r--r--jstests/core/mr2.js12
-rw-r--r--jstests/core/mr3.js12
-rw-r--r--jstests/core/mr4.js4
-rw-r--r--jstests/core/mr5.js46
-rw-r--r--jstests/core/mr_bigobject.js24
-rw-r--r--jstests/core/mr_comments.js14
-rw-r--r--jstests/core/mr_errorhandling.js16
-rw-r--r--jstests/core/mr_index.js46
-rw-r--r--jstests/core/mr_index2.js26
-rw-r--r--jstests/core/mr_index3.js26
-rw-r--r--jstests/core/mr_killop.js12
-rw-r--r--jstests/core/mr_merge.js42
-rw-r--r--jstests/core/mr_merge2.js22
-rw-r--r--jstests/core/mr_mutable_properties.js6
-rw-r--r--jstests/core/mr_optim.js4
-rw-r--r--jstests/core/mr_outreduce.js36
-rw-r--r--jstests/core/mr_outreduce2.js32
-rw-r--r--jstests/core/mr_replaceIntoDB.js24
-rw-r--r--jstests/core/mr_sort.js40
-rw-r--r--jstests/core/mr_stored.js64
-rw-r--r--jstests/core/mr_undef.js26
-rw-r--r--jstests/core/nan.js2
-rw-r--r--jstests/core/nin.js2
-rw-r--r--jstests/core/no_db_created.js8
-rw-r--r--jstests/core/not1.js6
-rw-r--r--jstests/core/not2.js6
-rw-r--r--jstests/core/null2.js4
-rw-r--r--jstests/core/numberint.js8
-rw-r--r--jstests/core/numberlong.js8
-rw-r--r--jstests/core/numberlong3.js2
-rw-r--r--jstests/core/objid1.js2
-rw-r--r--jstests/core/objid2.js2
-rw-r--r--jstests/core/objid4.js4
-rw-r--r--jstests/core/objid5.js14
-rw-r--r--jstests/core/objid7.js8
-rw-r--r--jstests/core/opcounters_active.js12
-rw-r--r--jstests/core/opcounters_write_cmd.js18
-rw-r--r--jstests/core/or1.js4
-rw-r--r--jstests/core/or2.js4
-rw-r--r--jstests/core/or3.js4
-rw-r--r--jstests/core/or4.js2
-rw-r--r--jstests/core/ore.js2
-rw-r--r--jstests/core/oro.js2
-rw-r--r--jstests/core/plan_cache_shell_helpers.js4
-rw-r--r--jstests/core/profile1.js10
-rw-r--r--jstests/core/profile3.js12
-rw-r--r--jstests/core/profile4.js6
-rw-r--r--jstests/core/proj_key1.js10
-rw-r--r--jstests/core/pull.js2
-rw-r--r--jstests/core/pull2.js16
-rw-r--r--jstests/core/pull_remove1.js16
-rw-r--r--jstests/core/pullall.js2
-rw-r--r--jstests/core/pullall2.js18
-rw-r--r--jstests/core/push.js14
-rw-r--r--jstests/core/push2.js6
-rw-r--r--jstests/core/push_sort.js38
-rw-r--r--jstests/core/query1.js14
-rw-r--r--jstests/core/queryoptimizera.js2
-rw-r--r--jstests/core/ref.js2
-rw-r--r--jstests/core/regex2.js4
-rw-r--r--jstests/core/regex5.js16
-rw-r--r--jstests/core/regex7.js26
-rw-r--r--jstests/core/regex8.js20
-rw-r--r--jstests/core/regex9.js12
-rw-r--r--jstests/core/regex_embed1.js12
-rw-r--r--jstests/core/regex_not_id.js2
-rw-r--r--jstests/core/remove.js2
-rw-r--r--jstests/core/remove6.js2
-rw-r--r--jstests/core/remove7.js2
-rw-r--r--jstests/core/remove8.js4
-rw-r--r--jstests/core/remove_justone.js22
-rw-r--r--jstests/core/remove_undefined.js34
-rw-r--r--jstests/core/rename2.js14
-rw-r--r--jstests/core/rename3.js8
-rw-r--r--jstests/core/rename4.js4
-rw-r--r--jstests/core/rename6.js4
-rw-r--r--jstests/core/rename7.js2
-rw-r--r--jstests/core/rename_stayTemp.js14
-rw-r--r--jstests/core/repair_database.js16
-rw-r--r--jstests/core/repair_server12955.js6
-rw-r--r--jstests/core/run_program1.js4
-rw-r--r--jstests/core/server1470.js6
-rw-r--r--jstests/core/server14747.js2
-rw-r--r--jstests/core/server14753.js2
-rw-r--r--jstests/core/server5346.js14
-rw-r--r--jstests/core/set3.js2
-rw-r--r--jstests/core/set4.js4
-rw-r--r--jstests/core/set5.js4
-rw-r--r--jstests/core/set6.js12
-rw-r--r--jstests/core/set_param1.js16
-rw-r--r--jstests/core/shell1.js6
-rw-r--r--jstests/core/shell_writeconcern.js32
-rw-r--r--jstests/core/shelltypes.js4
-rw-r--r--jstests/core/slice1.js4
-rw-r--r--jstests/core/snapshot_queries.js2
-rw-r--r--jstests/core/sort1.js10
-rw-r--r--jstests/core/sort10.js26
-rw-r--r--jstests/core/sort2.js4
-rw-r--r--jstests/core/sort4.js12
-rw-r--r--jstests/core/sort6.js28
-rw-r--r--jstests/core/sortg.js4
-rw-r--r--jstests/core/splitvector.js20
-rw-r--r--jstests/core/stages_and_hash.js8
-rw-r--r--jstests/core/stages_and_sorted.js2
-rw-r--r--jstests/core/stages_collection_scan.js8
-rw-r--r--jstests/core/stages_fetch.js4
-rw-r--r--jstests/core/stages_ixscan.js2
-rw-r--r--jstests/core/stages_limit_skip.js6
-rw-r--r--jstests/core/stages_mergesort.js6
-rw-r--r--jstests/core/stages_or.js6
-rw-r--r--jstests/core/stages_sort.js2
-rw-r--r--jstests/core/stages_text.js4
-rw-r--r--jstests/core/storefunc.js2
-rw-r--r--jstests/core/sub1.js2
-rw-r--r--jstests/core/tailable_skip_limit.js2
-rw-r--r--jstests/core/temp_cleanup.js14
-rw-r--r--jstests/core/top.js8
-rw-r--r--jstests/core/ts1.js24
-rw-r--r--jstests/core/update3.js6
-rw-r--r--jstests/core/update6.js8
-rw-r--r--jstests/core/update7.js4
-rw-r--r--jstests/core/update8.js4
-rw-r--r--jstests/core/update9.js6
-rw-r--r--jstests/core/update_addToSet.js12
-rw-r--r--jstests/core/update_addToSet2.js8
-rw-r--r--jstests/core/update_addToSet3.js22
-rw-r--r--jstests/core/update_arraymatch1.js14
-rw-r--r--jstests/core/update_arraymatch2.js4
-rw-r--r--jstests/core/update_arraymatch3.js4
-rw-r--r--jstests/core/update_arraymatch4.js22
-rw-r--r--jstests/core/update_arraymatch5.js6
-rw-r--r--jstests/core/update_arraymatch6.js2
-rw-r--r--jstests/core/update_bit_examples.js18
-rw-r--r--jstests/core/update_blank1.js2
-rw-r--r--jstests/core/update_currentdate_examples.js18
-rw-r--r--jstests/core/update_invalid1.js4
-rw-r--r--jstests/core/update_min_max_examples.js22
-rw-r--r--jstests/core/update_mul_examples.js30
-rw-r--r--jstests/core/update_multi3.js8
-rw-r--r--jstests/core/update_multi4.js4
-rw-r--r--jstests/core/update_multi5.js2
-rw-r--r--jstests/core/update_multi6.js4
-rw-r--r--jstests/core/update_replace.js18
-rw-r--r--jstests/core/updatea.js30
-rw-r--r--jstests/core/updateb.js2
-rw-r--r--jstests/core/updated.js2
-rw-r--r--jstests/core/updateh.js38
-rw-r--r--jstests/core/updatem.js14
-rw-r--r--jstests/core/upsert_and.js26
-rw-r--r--jstests/core/upsert_shell.js16
-rwxr-xr-xjstests/core/useindexonobjgtlt.js14
-rw-r--r--jstests/core/user_management_helpers.js4
-rw-r--r--jstests/core/verify_update_mods.js56
-rw-r--r--jstests/core/where3.js2
-rw-r--r--jstests/core/where4.js20
-rw-r--r--jstests/core/write_result.js2
421 files changed, 2670 insertions, 2670 deletions
diff --git a/jstests/core/all.js b/jstests/core/all.js
index 50087882ad1..d4ddd6c6ee4 100644
--- a/jstests/core/all.js
+++ b/jstests/core/all.js
@@ -39,7 +39,7 @@ doTest = function() {
assert.eq( 0 , t.find( { a : { $all : [] } } ).count() , "E3" );
-}
+};
doTest();
t.drop();
diff --git a/jstests/core/all2.js b/jstests/core/all2.js
index 64372ca5e97..6beb346775d 100644
--- a/jstests/core/all2.js
+++ b/jstests/core/all2.js
@@ -2,9 +2,9 @@
t = db.all2;
t.drop();
-t.save( { a : [ { x : 1 } , { x : 2 } ] } )
-t.save( { a : [ { x : 2 } , { x : 3 } ] } )
-t.save( { a : [ { x : 3 } , { x : 4 } ] } )
+t.save( { a : [ { x : 1 } , { x : 2 } ] } );
+t.save( { a : [ { x : 2 } , { x : 3 } ] } );
+t.save( { a : [ { x : 3 } , { x : 4 } ] } );
state = "no index";
@@ -42,9 +42,9 @@ check( 0 , { "a.x" : { $all : [ 1 , 3 ] } } , "H" );
t.drop();
-t.save( { a : [ 1 , 2 ] } )
-t.save( { a : [ 2 , 3 ] } )
-t.save( { a : [ 3 , 4 ] } )
+t.save( { a : [ 1 , 2 ] } );
+t.save( { a : [ 2 , 3 ] } );
+t.save( { a : [ 3 , 4 ] } );
state = "more no index";
@@ -76,10 +76,10 @@ check( 0 , { "a" : { $all : [ 1 , 3 ] } } , "H" );
// more 2
-state = "more 2"
+state = "more 2";
t.drop();
-t.save( { name : [ "harry","jack","tom" ] } )
+t.save( { name : [ "harry","jack","tom" ] } );
check( 0 , { name : { $all : ["harry","john"] } } , "A" );
t.ensureIndex( { name : 1 } );
check( 0 , { name : { $all : ["harry","john"] } } , "B" );
diff --git a/jstests/core/and.js b/jstests/core/and.js
index f05c289966f..ea2fec4554e 100644
--- a/jstests/core/and.js
+++ b/jstests/core/and.js
@@ -8,11 +8,11 @@ t.save( {a:'foo'} );
function check() {
// $and must be an array
- assert.throws( function() { t.find( {$and:4} ).toArray() } );
+ assert.throws( function() { t.find( {$and:4} ).toArray(); } );
// $and array must not be empty
- assert.throws( function() { t.find( {$and:[]} ).toArray() } );
+ assert.throws( function() { t.find( {$and:[]} ).toArray(); } );
// $and elements must be objects
- assert.throws( function() { t.find( {$and:[4]} ).toArray() } );
+ assert.throws( function() { t.find( {$and:[4]} ).toArray(); } );
// Check equality matching
assert.eq( 1, t.count( {$and:[{a:1}]} ) );
diff --git a/jstests/core/andor.js b/jstests/core/andor.js
index f433ade8228..73327acde9b 100644
--- a/jstests/core/andor.js
+++ b/jstests/core/andor.js
@@ -46,7 +46,7 @@ test = function() {
ok( {$nor:[{$and:[{$nor:[{a:1}]}]}]} );
-}
+};
test();
t.ensureIndex( {a:1} );
@@ -90,7 +90,7 @@ test = function() {
ok( {$nor:[{$and:[{$nor:[{a:{$ne:2}}]}]}]} );
-}
+};
t.drop();
t.save( {a:1} );
diff --git a/jstests/core/apitest_db.js b/jstests/core/apitest_db.js
index 8e5921915a1..f2271649016 100644
--- a/jstests/core/apitest_db.js
+++ b/jstests/core/apitest_db.js
@@ -6,7 +6,7 @@ assert( "test" == db, "wrong database currently not test" );
dd = function( x ){
//print( x );
-}
+};
dd( "a" );
@@ -48,13 +48,13 @@ var storageEngineName = db.serverStatus().storageEngine.name;
assert.commandFailed(db.createCollection('test', {storageEngine: 'not a document'}));
assert.commandWorked(db.createCollection('test', {storageEngine: {}}));
assert.commandFailed(db.createCollection('test', {storageEngine: {unknownStorageEngine: {}}}));
-var invalidStorageEngineOptions = {}
+var invalidStorageEngineOptions = {};
invalidStorageEngineOptions[storageEngineName] = 12345;
assert.commandFailed(db.createCollection('test', {storageEngine: invalidStorageEngineOptions}));
// Test round trip of storageEngine in collection options.
// Assume that empty document for storageEngine-specific options is acceptable.
-var validStorageEngineOptions = {}
+var validStorageEngineOptions = {};
validStorageEngineOptions[storageEngineName] = {};
db.getCollection('test').drop();
assert.commandWorked(db.createCollection('test', {storageEngine: validStorageEngineOptions}));
@@ -148,6 +148,6 @@ dd( "g" );
-assert.eq( "foo" , db.getSisterDB( "foo" ).getName() )
-assert.eq( "foo" , db.getSiblingDB( "foo" ).getName() )
+assert.eq( "foo" , db.getSisterDB( "foo" ).getName() );
+assert.eq( "foo" , db.getSiblingDB( "foo" ).getName() );
diff --git a/jstests/core/array1.js b/jstests/core/array1.js
index 4409b7bb4d3..3a27feb028a 100644
--- a/jstests/core/array1.js
+++ b/jstests/core/array1.js
@@ -1,5 +1,5 @@
-t = db.array1
-t.drop()
+t = db.array1;
+t.drop();
x = { a : [ 1 , 2 ] };
diff --git a/jstests/core/array3.js b/jstests/core/array3.js
index 3d053f99417..8b024bd3a0c 100644
--- a/jstests/core/array3.js
+++ b/jstests/core/array3.js
@@ -1,8 +1,8 @@
-assert.eq( 5 , Array.sum( [ 1 , 4 ] ), "A" )
-assert.eq( 2.5 , Array.avg( [ 1 , 4 ] ), "B" )
+assert.eq( 5 , Array.sum( [ 1 , 4 ] ), "A" );
+assert.eq( 2.5 , Array.avg( [ 1 , 4 ] ), "B" );
-arr = [ 2 , 4 , 4 , 4 , 5 , 5 , 7 , 9 ]
-assert.eq( 5 , Array.avg( arr ) , "C" )
-assert.eq( 2 , Array.stdDev( arr ) , "D" )
+arr = [ 2 , 4 , 4 , 4 , 5 , 5 , 7 , 9 ];
+assert.eq( 5 , Array.avg( arr ) , "C" );
+assert.eq( 2 , Array.stdDev( arr ) , "D" );
diff --git a/jstests/core/array_match1.js b/jstests/core/array_match1.js
index f764fb913b1..194ebcb85c3 100644
--- a/jstests/core/array_match1.js
+++ b/jstests/core/array_match1.js
@@ -1,31 +1,31 @@
-t = db.array_match1
+t = db.array_match1;
t.drop();
-t.insert( { _id : 1 , a : [ 5 , 5 ] } )
-t.insert( { _id : 2 , a : [ 6 , 6 ] } )
-t.insert( { _id : 3 , a : [ 5 , 5 ] } )
+t.insert( { _id : 1 , a : [ 5 , 5 ] } );
+t.insert( { _id : 2 , a : [ 6 , 6 ] } );
+t.insert( { _id : 3 , a : [ 5 , 5 ] } );
function test( f , m ){
var q = {};
q[f] = [5,5];
- assert.eq( 2 , t.find( q ).itcount() , m + "1" )
+ assert.eq( 2 , t.find( q ).itcount() , m + "1" );
q[f] = [6,6];
- assert.eq( 1 , t.find( q ).itcount() , m + "2" )
+ assert.eq( 1 , t.find( q ).itcount() , m + "2" );
}
test( "a" , "A" );
-t.ensureIndex( { a : 1 } )
+t.ensureIndex( { a : 1 } );
test( "a" , "B" );
t.drop();
-t.insert( { _id : 1 , a : { b : [ 5 , 5 ] } } )
-t.insert( { _id : 2 , a : { b : [ 6 , 6 ] } } )
-t.insert( { _id : 3 , a : { b : [ 5 , 5 ] } } )
+t.insert( { _id : 1 , a : { b : [ 5 , 5 ] } } );
+t.insert( { _id : 2 , a : { b : [ 6 , 6 ] } } );
+t.insert( { _id : 3 , a : { b : [ 5 , 5 ] } } );
test( "a.b" , "C" );
-t.ensureIndex( { a : 1 } )
+t.ensureIndex( { a : 1 } );
test( "a.b" , "D" );
diff --git a/jstests/core/arrayfind1.js b/jstests/core/arrayfind1.js
index a731dd6bdf9..5a9f2227806 100644
--- a/jstests/core/arrayfind1.js
+++ b/jstests/core/arrayfind1.js
@@ -2,9 +2,9 @@
t = db.arrayfind1;
t.drop();
-t.save( { a : [ { x : 1 } ] } )
-t.save( { a : [ { x : 1 , y : 2 , z : 1 } ] } )
-t.save( { a : [ { x : 1 , y : 1 , z : 3 } ] } )
+t.save( { a : [ { x : 1 } ] } );
+t.save( { a : [ { x : 1 , y : 2 , z : 1 } ] } );
+t.save( { a : [ { x : 1 , y : 1 , z : 3 } ] } );
function test( exptected , q , name ){
assert.eq( exptected , t.find( q ).itcount() , name + " " + tojson( q ) + " itcount" );
@@ -17,9 +17,9 @@ test( 1 , { "a" : { x : 1 } } , "A3" );
test( 3 , { "a" : { $elemMatch : { x : 1 } } } , "A4" ); // SERVER-377
-t.save( { a : [ { x : 2 } ] } )
-t.save( { a : [ { x : 3 } ] } )
-t.save( { a : [ { x : 4 } ] } )
+t.save( { a : [ { x : 2 } ] } );
+t.save( { a : [ { x : 3 } ] } );
+t.save( { a : [ { x : 4 } ] } );
assert.eq( 1 , t.find( { a : { $elemMatch : { x : 2 } } } ).count() , "B1" );
assert.eq( 2 , t.find( { a : { $elemMatch : { x : { $gt : 2 } } } } ).count() , "B2" );
diff --git a/jstests/core/arrayfind2.js b/jstests/core/arrayfind2.js
index ca6b57c518b..b292b13bf52 100644
--- a/jstests/core/arrayfind2.js
+++ b/jstests/core/arrayfind2.js
@@ -9,14 +9,14 @@ function go( prefix ){
assert.eq( 1 , t.find( { a : { $all : [ { $elemMatch : { x : { $lt : 4 } } } ,
{ $elemMatch : { x : { $gt : 5 } } } ] } } ).count() , prefix + " A4" );
- assert.throws( function() { return t.findOne( { a : { $all : [ 1, { $elemMatch : { x : 3 } } ] } } ) } );
- assert.throws( function() { return t.findOne( { a : { $all : [ /a/, { $elemMatch : { x : 3 } } ] } } ) } );
+ assert.throws( function() { return t.findOne( { a : { $all : [ 1, { $elemMatch : { x : 3 } } ] } } ); } );
+ assert.throws( function() { return t.findOne( { a : { $all : [ /a/, { $elemMatch : { x : 3 } } ] } } ); } );
}
-t.save( { a : [ { x : 1 } , { x : 5 } ] } )
-t.save( { a : [ { x : 3 } , { x : 5 } ] } )
-t.save( { a : [ { x : 3 } , { x : 6 } ] } )
+t.save( { a : [ { x : 1 } , { x : 5 } ] } );
+t.save( { a : [ { x : 3 } , { x : 5 } ] } );
+t.save( { a : [ { x : 3 } , { x : 6 } ] } );
go( "no index" );
t.ensureIndex( { a : 1 } );
diff --git a/jstests/core/arrayfind3.js b/jstests/core/arrayfind3.js
index de038c84264..395b428ac1f 100644
--- a/jstests/core/arrayfind3.js
+++ b/jstests/core/arrayfind3.js
@@ -1,16 +1,16 @@
t = db.arrayfind3;
-t.drop()
+t.drop();
-t.save({a:[1,2]})
-t.save({a:[1, 2, 6]})
-t.save({a:[1, 4, 6]})
+t.save({a:[1,2]});
+t.save({a:[1, 2, 6]});
+t.save({a:[1, 4, 6]});
-assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "A1" )
-assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "A2" )
+assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "A1" );
+assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "A2" );
-t.ensureIndex( { a : 1 } )
+t.ensureIndex( { a : 1 } );
assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "B1" );
-assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "B2" )
+assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "B2" );
diff --git a/jstests/core/auth1.js b/jstests/core/auth1.js
index 4ab26e8d2e5..268f55f2af8 100644
--- a/jstests/core/auth1.js
+++ b/jstests/core/auth1.js
@@ -40,15 +40,15 @@ var before = a.system.users.count({db: mydb.getName()});
assert.throws( function(){
mydb.createUser({ user: "" , pwd: "abc", roles: jsTest.basicUserRoles});
-} , null , "C1" )
+} , null , "C1" );
assert.throws( function(){
mydb.createUser({ user: "abc" , pwd: "", roles: jsTest.basicUserRoles});
-} , null , "C2" )
+} , null , "C2" );
var after = a.system.users.count({db: mydb.getName()});
-assert( before > 0 , "C3" )
-assert.eq( before , after , "C4" )
+assert( before > 0 , "C3" );
+assert.eq( before , after , "C4" );
// Clean up after ourselves so other tests using authentication don't get messed up.
-mydb.dropAllUsers()
+mydb.dropAllUsers();
diff --git a/jstests/core/auth2.js b/jstests/core/auth2.js
index 9c2b38f682d..2c4cff6796b 100644
--- a/jstests/core/auth2.js
+++ b/jstests/core/auth2.js
@@ -3,7 +3,7 @@
// SERVER-724
db.runCommand({logout : 1});
x = db.runCommand({logout : 1});
-assert.eq( 1 , x.ok , "A" )
+assert.eq( 1 , x.ok , "A" );
x = db.logout();
-assert.eq( 1 , x.ok , "B" )
+assert.eq( 1 , x.ok , "B" );
diff --git a/jstests/core/basic3.js b/jstests/core/basic3.js
index 5fb5581a252..61f68047d30 100644
--- a/jstests/core/basic3.js
+++ b/jstests/core/basic3.js
@@ -1,22 +1,22 @@
// Tests that "." cannot be in field names
t = db.getCollection( "foo_basic3" );
-t.drop()
+t.drop();
//more diagnostics on bad save, if exception fails
doBadSave = function(param) {
- print("doing save with " + tojson(param))
+ print("doing save with " + tojson(param));
var res = t.save(param);
// Should not get here.
printjson(res);
-}
+};
//more diagnostics on bad save, if exception fails
doBadUpdate = function(query, update) {
- print("doing update with " + tojson(query) + " " + tojson(update))
+ print("doing update with " + tojson(query) + " " + tojson(update));
var res = t.update(query, update);
// Should not get here.
printjson(res);
-}
+};
assert.throws(doBadSave, [{"a.b":5}], ". in names aren't allowed doesn't work");
@@ -25,7 +25,7 @@ assert.throws(doBadSave,
". in embedded names aren't allowed doesn't work");
// following tests make sure update keys are checked
-t.save({"a": 0,"b": 1})
+t.save({"a": 0,"b": 1});
assert.throws(doBadUpdate, [{a:0}, { "b.b" : 1 }],
"must deny '.' in key of update");
@@ -35,11 +35,11 @@ assert.throws(doBadUpdate, [{a:10}, { c: {"b.b" : 1 }}],
"must deny embedded '.' in key of update");
// if it is a modifier, it should still go through
-t.update({"a": 0}, {$set: { "c.c": 1}})
-t.update({"a": 0}, {$inc: { "c.c": 1}})
+t.update({"a": 0}, {$set: { "c.c": 1}});
+t.update({"a": 0}, {$inc: { "c.c": 1}});
// edge cases
assert.throws(doBadUpdate, [{a:0}, { "":{"b.b" : 1} }],
"must deny '' embedded '.' in key of update");
-t.update({"a": 0}, {})
+t.update({"a": 0}, {});
diff --git a/jstests/core/basic7.js b/jstests/core/basic7.js
index 7bb0d470e82..4ae7d6902b3 100644
--- a/jstests/core/basic7.js
+++ b/jstests/core/basic7.js
@@ -2,7 +2,7 @@
t = db.basic7;
t.drop();
-t.save( { a : 1 } )
+t.save( { a : 1 } );
t.ensureIndex( { a : 1 } );
assert.eq( t.find().toArray()[0].a , 1 );
diff --git a/jstests/core/basic9.js b/jstests/core/basic9.js
index 814b72b2ae7..3078fcad2bc 100644
--- a/jstests/core/basic9.js
+++ b/jstests/core/basic9.js
@@ -1,14 +1,14 @@
// Tests that $<prefix> field names are not allowed, but you can use a $ anywhere else.
t = db.getCollection( "foo_basic9" );
-t.drop()
+t.drop();
// more diagnostics on bad save, if exception fails
doBadSave = function(param) {
- print("doing save with " + tojson(param))
+ print("doing save with " + tojson(param));
var res = t.save(param);
// Should not get here.
print('Should have errored out: ' + tojson(res));
-}
+};
t.save({foo$foo:5});
t.save({foo$:5});
diff --git a/jstests/core/batch_write_command_delete.js b/jstests/core/batch_write_command_delete.js
index 068c3a19d73..eb08179e463 100644
--- a/jstests/core/batch_write_command_delete.js
+++ b/jstests/core/batch_write_command_delete.js
@@ -19,13 +19,13 @@ function resultOK( result ) {
!( 'errmsg' in result ) &&
!( 'errInfo' in result ) &&
!( 'writeErrors' in result );
-};
+}
function resultNOK( result ) {
return !result.ok &&
typeof( result.code ) == 'number' &&
typeof( result.errmsg ) == 'string';
-};
+}
// EACH TEST BELOW SHOULD BE SELF-CONTAINED, FOR EASIER DEBUGGING
diff --git a/jstests/core/batch_write_command_insert.js b/jstests/core/batch_write_command_insert.js
index a9c271f3d24..f0b2ed24985 100644
--- a/jstests/core/batch_write_command_insert.js
+++ b/jstests/core/batch_write_command_insert.js
@@ -19,13 +19,13 @@ function resultOK( result ) {
!( 'errmsg' in result ) &&
!( 'errInfo' in result ) &&
!( 'writeErrors' in result );
-};
+}
function resultNOK( result ) {
return !result.ok &&
typeof( result.code ) == 'number' &&
typeof( result.errmsg ) == 'string';
-};
+}
// EACH TEST BELOW SHOULD BE SELF-CONTAINED, FOR EASIER DEBUGGING
diff --git a/jstests/core/batch_write_command_update.js b/jstests/core/batch_write_command_update.js
index 255c23d877e..00964131efe 100644
--- a/jstests/core/batch_write_command_update.js
+++ b/jstests/core/batch_write_command_update.js
@@ -5,7 +5,7 @@
var coll = db.getCollection( "batch_write_update" );
coll.drop();
-assert(coll.getDB().getMongo().useWriteCommands(), "test is not running with write commands")
+assert(coll.getDB().getMongo().useWriteCommands(), "test is not running with write commands");
var request;
var result;
@@ -19,13 +19,13 @@ function resultOK( result ) {
!( 'errmsg' in result ) &&
!( 'errInfo' in result ) &&
!( 'writeErrors' in result );
-};
+}
function resultNOK( result ) {
return !result.ok &&
typeof( result.code ) == 'number' &&
typeof( result.errmsg ) == 'string';
-};
+}
// EACH TEST BELOW SHOULD BE SELF-CONTAINED, FOR EASIER DEBUGGING
@@ -51,7 +51,7 @@ assert.eq(0, result.upserted[0].index);
// Count the upserted doc
var upsertedId = result.upserted[0]._id;
assert.eq(1, coll.count({_id: upsertedId}));
-assert.eq(0, result.nModified, "missing/wrong nModified")
+assert.eq(0, result.nModified, "missing/wrong nModified");
//
// Single document upsert, write concern specified, no ordered specified
@@ -69,7 +69,7 @@ assert.eq(0, result.upserted[0].index);
// Count the upserted doc
upsertedId = result.upserted[0]._id;
assert.eq(1, coll.count({_id: upsertedId}));
-assert.eq(0, result.nModified, "missing/wrong nModified")
+assert.eq(0, result.nModified, "missing/wrong nModified");
//
// Single document upsert, write concern specified, ordered = true
@@ -88,7 +88,7 @@ assert.eq(0, result.upserted[0].index);
// Count the upserted doc
upsertedId = result.upserted[0]._id;
assert.eq(1, coll.count({_id: upsertedId}));
-assert.eq(0, result.nModified, "missing/wrong nModified")
+assert.eq(0, result.nModified, "missing/wrong nModified");
//
// Single document upsert, write concern 0 specified, ordered = true
diff --git a/jstests/core/bench_test1.js b/jstests/core/bench_test1.js
index 26d82e79a79..bbc38af2ba5 100644
--- a/jstests/core/bench_test1.js
+++ b/jstests/core/bench_test1.js
@@ -2,13 +2,13 @@
t = db.bench_test1;
t.drop();
-t.insert( { _id : 1 , x : 1 } )
-t.insert( { _id : 2 , x : 1 } )
+t.insert( { _id : 1 , x : 1 } );
+t.insert( { _id : 2 , x : 1 } );
ops = [
{ op : "findOne" , ns : t.getFullName() , query : { _id : 1 } } ,
{ op : "update" , ns : t.getFullName() , query : { _id : 1 } , update : { $inc : { x : 1 } } }
-]
+];
seconds = 2;
@@ -21,15 +21,15 @@ if (jsTest.options().auth) {
}
res = benchRun( benchArgs );
-assert.lte( seconds * res.update , t.findOne( { _id : 1 } ).x * 1.5 , "A1" )
+assert.lte( seconds * res.update , t.findOne( { _id : 1 } ).x * 1.5 , "A1" );
-assert.eq( 1 , t.getIndexes().length , "B1" )
+assert.eq( 1 , t.getIndexes().length , "B1" );
benchArgs['ops']=[ { op : "createIndex" , ns : t.getFullName() , key : { x : 1 } } ];
benchArgs['parallel']=1;
benchArgs['seconds']=1;
benchRun( benchArgs );
-assert.eq( 2 , t.getIndexes().length , "B2" )
+assert.eq( 2 , t.getIndexes().length , "B2" );
benchArgs['ops']=[ { op : "dropIndex" , ns : t.getFullName() , key : { x : 1 } } ];
benchRun( benchArgs );
assert.soon( function(){ return t.getIndexes().length == 1; } );
diff --git a/jstests/core/bench_test2.js b/jstests/core/bench_test2.js
index ccf7ed20e67..c2e3881632c 100644
--- a/jstests/core/bench_test2.js
+++ b/jstests/core/bench_test2.js
@@ -1,5 +1,5 @@
-t = db.bench_test2
+t = db.bench_test2;
t.drop();
for ( i=0; i<100; i++ )
@@ -11,7 +11,7 @@ benchArgs = { ops : [ { ns : t.getFullName() ,
update : { $inc : { x : 1 } } } ] ,
parallel : 2 ,
seconds : 1 ,
- host : db.getMongo().host }
+ host : db.getMongo().host };
if (jsTest.options().auth) {
benchArgs['db'] = 'admin';
@@ -19,13 +19,13 @@ if (jsTest.options().auth) {
benchArgs['password'] = jsTest.options().adminPassword;
}
-res = benchRun( benchArgs )
+res = benchRun( benchArgs );
printjson( res );
-sumsq = 0
-sum = 0
+sumsq = 0;
+sum = 0;
-min = 1000
+min = 1000;
max = 0;
t.find().forEach(
function(z){
@@ -34,14 +34,14 @@ t.find().forEach(
min = Math.min( z.x , min );
max = Math.max( z.x , max );
}
-)
+);
-avg = sum / 100
-std = Math.sqrt( sumsq / 100 )
+avg = sum / 100;
+std = Math.sqrt( sumsq / 100 );
-print( "Avg: " + avg )
-print( "Std: " + std )
-print( "Min: " + min )
-print( "Max: " + max )
+print( "Avg: " + avg );
+print( "Std: " + std );
+print( "Min: " + min );
+print( "Max: " + max );
diff --git a/jstests/core/bench_test3.js b/jstests/core/bench_test3.js
index 1df22f05810..2e130662829 100644
--- a/jstests/core/bench_test3.js
+++ b/jstests/core/bench_test3.js
@@ -1,4 +1,4 @@
-t = db.bench_test3
+t = db.bench_test3;
t.drop();
@@ -9,7 +9,7 @@ benchArgs = { ops : [ { ns : t.getFullName() ,
update : { $inc : { x : 1 } } } ] ,
parallel : 2 ,
seconds : 5 ,
- host : db.getMongo().host }
+ host : db.getMongo().host };
if (jsTest.options().auth) {
benchArgs['db'] = 'admin';
@@ -17,11 +17,11 @@ if (jsTest.options().auth) {
benchArgs['password'] = jsTest.options().adminPassword;
}
-res = benchRun( benchArgs )
+res = benchRun( benchArgs );
printjson( res );
-var keys = []
-var totals = {}
-db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x } );
+var keys = [];
+var totals = {};
+db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x; } );
printjson(totals);
-assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys )
+assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys );
diff --git a/jstests/core/big_object1.js b/jstests/core/big_object1.js
index e567cf8ce93..82ecf025799 100644
--- a/jstests/core/big_object1.js
+++ b/jstests/core/big_object1.js
@@ -1,5 +1,5 @@
-t = db.big_object1
+t = db.big_object1;
t.drop();
if ( db.adminCommand( "buildinfo" ).bits == 64 ){
@@ -12,12 +12,12 @@ if ( db.adminCommand( "buildinfo" ).bits == 64 ){
x = 0;
while ( true ){
var result;
- n = { _id : x , a : [] }
+ n = { _id : x , a : [] };
for ( i=0; i<14+x; i++ )
- n.a.push( s )
+ n.a.push( s );
try {
- result = t.insert( n )
- o = n
+ result = t.insert( n );
+ o = n;
}
catch ( e ){
break;
@@ -28,15 +28,15 @@ if ( db.adminCommand( "buildinfo" ).bits == 64 ){
x++;
}
- printjson( t.stats(1024*1024) )
+ printjson( t.stats(1024*1024) );
- assert.lt( 15 * 1024 * 1024 , Object.bsonsize( o ) , "A1" )
- assert.gt( 17 * 1024 * 1024 , Object.bsonsize( o ) , "A2" )
+ assert.lt( 15 * 1024 * 1024 , Object.bsonsize( o ) , "A1" );
+ assert.gt( 17 * 1024 * 1024 , Object.bsonsize( o ) , "A2" );
- assert.eq( x , t.count() , "A3" )
+ assert.eq( x , t.count() , "A3" );
for ( i=0; i<x; i++ ){
- o = t.findOne( { _id : i } )
+ o = t.findOne( { _id : i } );
try {
// test large mongo -> js conversion
var a = o.a;
@@ -46,10 +46,10 @@ if ( db.adminCommand( "buildinfo" ).bits == 64 ){
assert( o , "B" + i );
}
- t.drop()
+ t.drop();
}
else {
- print( "skipping big_object1 b/c not 64-bit" )
+ print( "skipping big_object1 b/c not 64-bit" );
}
print("SUCCESS");
diff --git a/jstests/core/bulk_api_ordered.js b/jstests/core/bulk_api_ordered.js
index 6cc032f68fc..87ecd66a1b5 100644
--- a/jstests/core/bulk_api_ordered.js
+++ b/jstests/core/bulk_api_ordered.js
@@ -140,7 +140,7 @@ var executeTests = function() {
coll.dropIndexes();
coll.remove({});
coll.ensureIndex({a : 1}, {unique : true});
-}
+};
var buildVersion = parseInt(db.runCommand({buildInfo:1}).versionArray.slice(0, 3).join(""), 10);
// Save the existing useWriteCommands function
@@ -153,7 +153,7 @@ if(buildVersion >= 255) {
// Force the use of useWriteCommands
coll._mongo.useWriteCommands = function() {
return true;
- }
+ };
// Execute tests using legacy operations
executeTests();
@@ -162,7 +162,7 @@ if(buildVersion >= 255) {
// Force the use of legacy commands
coll._mongo.useWriteCommands = function() {
return false;
-}
+};
// Execute tests using legacy operations
executeTests();
diff --git a/jstests/core/bulk_api_unordered.js b/jstests/core/bulk_api_unordered.js
index 64893fe011a..0323dabd10b 100644
--- a/jstests/core/bulk_api_unordered.js
+++ b/jstests/core/bulk_api_unordered.js
@@ -155,7 +155,7 @@ var executeTests = function() {
coll.dropIndexes();
coll.remove({});
coll.ensureIndex({a : 1}, {unique : true});
-}
+};
var buildVersion = parseInt(db.runCommand({buildInfo:1}).versionArray.slice(0, 3).join(""), 10);
// Save the existing useWriteCommands function
@@ -168,7 +168,7 @@ if(buildVersion >= 255) {
// Force the use of useWriteCommands
coll._mongo.useWriteCommands = function() {
return true;
- }
+ };
// Execute tests using legacy operations
executeTests();
@@ -177,7 +177,7 @@ if(buildVersion >= 255) {
// Force the use of legacy commands
coll._mongo.useWriteCommands = function() {
return false;
-}
+};
// Execute tests using legacy operations
executeTests();
diff --git a/jstests/core/bulk_insert.js b/jstests/core/bulk_insert.js
index e2e625e0a3c..a946cba8ddb 100644
--- a/jstests/core/bulk_insert.js
+++ b/jstests/core/bulk_insert.js
@@ -1,24 +1,24 @@
// Tests bulk insert of docs from the shell
-var coll = db.bulkInsertTest
-coll.drop()
+var coll = db.bulkInsertTest;
+coll.drop();
var seed = new Date().getTime();
Random.srand( seed );
print("Seed for randomized test is " + seed);
-var bulkSize = Math.floor( Random.rand() * 200 ) + 1
-var numInserts = Math.floor( Random.rand() * 300 ) + 1
+var bulkSize = Math.floor( Random.rand() * 200 ) + 1;
+var numInserts = Math.floor( Random.rand() * 300 ) + 1;
-print( "Inserting " + numInserts + " bulks of " + bulkSize + " documents." )
+print( "Inserting " + numInserts + " bulks of " + bulkSize + " documents." );
for( var i = 0; i < numInserts; i++ ){
- var bulk = []
+ var bulk = [];
for( var j = 0; j < bulkSize; j++ ){
- bulk.push({ hi : "there", i : i, j : j })
+ bulk.push({ hi : "there", i : i, j : j });
}
- coll.insert( bulk )
+ coll.insert( bulk );
}
-assert.eq( coll.count(), bulkSize * numInserts )
+assert.eq( coll.count(), bulkSize * numInserts );
diff --git a/jstests/core/capped1.js b/jstests/core/capped1.js
index 0bbeaa40894..96099d7a9fd 100644
--- a/jstests/core/capped1.js
+++ b/jstests/core/capped1.js
@@ -6,6 +6,6 @@ db.createCollection("capped1" , {capped:true, size:1024 });
v = t.validate();
assert( v.valid , "A : " + tojson( v ) ); // SERVER-485
-t.save( { x : 1 } )
-assert( t.validate().valid , "B" )
+t.save( { x : 1 } );
+assert( t.validate().valid , "B" );
diff --git a/jstests/core/capped5.js b/jstests/core/capped5.js
index 8541901f34c..8a40c78ae98 100644
--- a/jstests/core/capped5.js
+++ b/jstests/core/capped5.js
@@ -1,17 +1,17 @@
-tn = "capped5"
+tn = "capped5";
-t = db[tn]
+t = db[tn];
t.drop();
db.createCollection( tn , {capped: true, size: 1024 * 1024 * 1 } );
t.insert( { _id : 5 , x : 11 , z : 52 } );
-assert.eq( 1 , t.getIndexKeys().length , "A0" ) //now we assume _id index even on capped coll
+assert.eq( 1 , t.getIndexKeys().length , "A0" ); //now we assume _id index even on capped coll
assert.eq( 52 , t.findOne( { x : 11 } ).z , "A1" );
-t.ensureIndex( { _id : 1 } )
-t.ensureIndex( { x : 1 } )
+t.ensureIndex( { _id : 1 } );
+t.ensureIndex( { x : 1 } );
assert.eq( 52 , t.findOne( { x : 11 } ).z , "B1" );
assert.eq( 52 , t.findOne( { _id : 5 } ).z , "B2" );
diff --git a/jstests/core/capped6.js b/jstests/core/capped6.js
index d85e93e6781..e643c77760d 100644
--- a/jstests/core/capped6.js
+++ b/jstests/core/capped6.js
@@ -77,7 +77,7 @@
count -= (n + inc);
valueArrayCurIndex -= (n + inc);
checkOrder(valueArrayCurIndex, valueArray);
- };
+ }
// We return the index of the next document that should be inserted into the capped
// collection, which would be the document after valueArrayCurIndex.
return valueArrayCurIndex + 1;
@@ -100,5 +100,5 @@
// Same test as above, but now the newer documents take less space than the
// older documents instead of more.
- doTest(true)
+ doTest(true);
})();
diff --git a/jstests/core/capped9.js b/jstests/core/capped9.js
index 2e0c2c74640..50ebb64744f 100644
--- a/jstests/core/capped9.js
+++ b/jstests/core/capped9.js
@@ -4,22 +4,22 @@ t.drop();
db.createCollection("capped9" , {capped:true, size:1024*50 });
-t.insert( { _id : 1 , x : 2 , y : 3 } )
+t.insert( { _id : 1 , x : 2 , y : 3 } );
-assert.eq( 1 , t.find( { x : 2 } ).itcount() , "A1" )
-assert.eq( 1 , t.find( { y : 3 } ).itcount() , "A2" )
+assert.eq( 1 , t.find( { x : 2 } ).itcount() , "A1" );
+assert.eq( 1 , t.find( { y : 3 } ).itcount() , "A2" );
//assert.throws( function(){ t.find( { _id : 1 } ).itcount(); } , [] , "A3" ); // SERVER-3064
-t.update( { _id : 1 } , { $set : { y : 4 } } )
+t.update( { _id : 1 } , { $set : { y : 4 } } );
//assert( db.getLastError() , "B1" ); // SERVER-3064
//assert.eq( 3 , t.findOne().y , "B2" ); // SERVER-3064
-t.ensureIndex( { _id : 1 } )
+t.ensureIndex( { _id : 1 } );
-assert.eq( 1 , t.find( { _id : 1 } ).itcount() , "D1" )
+assert.eq( 1 , t.find( { _id : 1 } ).itcount() , "D1" );
assert.writeOK( t.update( { _id: 1 }, { $set: { y: 4 } } ));
-assert.eq( 4 , t.findOne().y , "D2" )
+assert.eq( 4 , t.findOne().y , "D2" );
diff --git a/jstests/core/capped_empty.js b/jstests/core/capped_empty.js
index 02c6bef4e45..b922dca0d46 100644
--- a/jstests/core/capped_empty.js
+++ b/jstests/core/capped_empty.js
@@ -2,7 +2,7 @@
t = db.capped_empty;
t.drop();
-db.createCollection( t.getName() , { capped : true , size : 100 } )
+db.createCollection( t.getName() , { capped : true , size : 100 } );
t.insert( { x : 1 } );
t.insert( { x : 2 } );
diff --git a/jstests/core/capped_update.js b/jstests/core/capped_update.js
index ab93afed69f..293cada4f8e 100644
--- a/jstests/core/capped_update.js
+++ b/jstests/core/capped_update.js
@@ -24,7 +24,7 @@
assert.commandWorked(t.getDB().runCommand({godinsert:t.getName(), obj:{a:2}}));
var doc = t.findOne({a:2});
assert.eq(undefined, doc["_id"], "now has _id after godinsert");
- assert.writeOK(t.update({a:2}, {$inc:{a:1}}))
+ assert.writeOK(t.update({a:2}, {$inc:{a:1}}));
doc = t.findOne({a:3});
assert.eq(undefined, doc["_id"], "now has _id after update");
})();
diff --git a/jstests/core/cappeda.js b/jstests/core/cappeda.js
index 4292a989511..79df5f33aa6 100644
--- a/jstests/core/cappeda.js
+++ b/jstests/core/cappeda.js
@@ -1,15 +1,15 @@
t = db.scan_capped_id;
-t.drop()
+t.drop();
-x = t.runCommand( "create" , { capped : true , size : 10000 } )
-assert( x.ok )
+x = t.runCommand( "create" , { capped : true , size : 10000 } );
+assert( x.ok );
for ( i=0; i<100; i++ )
- t.insert( { _id : i , x : 1 } )
+ t.insert( { _id : i , x : 1 } );
function q() {
- return t.findOne( { _id : 5 } )
+ return t.findOne( { _id : 5 } );
}
function u() {
@@ -23,10 +23,10 @@ function u() {
//assert.throws( q , [] , "A1" );
//assert.throws( u , [] , "B1" );
-t.ensureIndex( { _id : 1 } )
+t.ensureIndex( { _id : 1 } );
-assert.eq( 1 , q().x )
-q()
-u()
+assert.eq( 1 , q().x );
+q();
+u();
-assert.eq( 2 , q().x )
+assert.eq( 2 , q().x );
diff --git a/jstests/core/check_shard_index.js b/jstests/core/check_shard_index.js
index f85071124fb..a862715e5e6 100644
--- a/jstests/core/check_shard_index.js
+++ b/jstests/core/check_shard_index.js
@@ -45,7 +45,7 @@ assert.eq( false , res.ok , "2b " + tojson(res) );
// Check _id index
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {_id:1} });
assert.eq( true , res.ok , "2c " + tojson(res) );
-assert( res.idskip , "2d " + tojson(res) )
+assert( res.idskip , "2d " + tojson(res) );
// -------------------------
// Case 3: entry with array values would make an index unsuitable
@@ -69,7 +69,7 @@ assert.eq( 1 , f.count() , "3. count after removing array value should be 1" );
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1, y:1} });
assert.eq( true , res.ok , "3b " + tojson(res) );
-f.save( { x : 2, y : [1, 2] } )
+f.save( { x : 2, y : [1, 2] } );
assert.eq( 2 , f.count() , "3. count after adding array value should be 2" );
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1, y:1} });
@@ -110,7 +110,7 @@ assert.eq( 1 , f.count() , "4. count after removing array value should be 1" );
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1, y:1, z:1} });
assert.eq( true , res.ok , "4f " + tojson(res) );
-f.save( { x : 3, y : [1, 2], z : 3 } )
+f.save( { x : 3, y : [1, 2], z : 3 } );
assert.eq( 2 , f.count() , "4. count after adding array value on second key should be 2" );
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1} });
@@ -127,7 +127,7 @@ assert.eq( 1 , f.count() , "4. count after removing array value should be 1 agai
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1, y:1, z:1} });
assert.eq( true , res.ok , "4e " + tojson(res) );
-f.save( { x : 4, y : 4, z : [1, 2] } )
+f.save( { x : 4, y : 4, z : [1, 2] } );
assert.eq( 2 , f.count() , "4. count after adding array value on third key should be 2" );
res = db.runCommand( { checkShardingIndex: "test.jstests_shardingindex" , keyPattern: {x:1} });
diff --git a/jstests/core/collmod.js b/jstests/core/collmod.js
index 31796b639da..f901c8a3e6f 100644
--- a/jstests/core/collmod.js
+++ b/jstests/core/collmod.js
@@ -32,7 +32,7 @@ function findCollectionInfo() {
assert.commandFailed(t.runCommand('collmod', {NotARealOption:1}));
// add a TTL index
-t.ensureIndex( {a : 1}, { "expireAfterSeconds": 50 } )
+t.ensureIndex( {a : 1}, { "expireAfterSeconds": 50 } );
assert( findTTL( { a : 1 }, 50 ), "TTL index not added" );
// try to modify it with a bad key pattern
@@ -61,7 +61,7 @@ assert( findTTL( {a:1}, 100 ), "TTL index not modified" );
// try to modify a faulty TTL index with a non-numeric expireAfterSeconds field
t.dropIndex( {a : 1 } );
-t.ensureIndex( {a : 1} , { "expireAfterSeconds": "50" } )
+t.ensureIndex( {a : 1} , { "expireAfterSeconds": "50" } );
var res = db.runCommand( { "collMod" : coll,
"index" : { "keyPattern" : {a : 1} , "expireAfterSeconds" : 100 } } );
debug( res );
@@ -69,7 +69,7 @@ assert.eq( 0, res.ok, "shouldn't be able to modify faulty index spec" );
// try with new index, this time set both expireAfterSeconds and the usePowerOf2Sizes flag
t.dropIndex( {a : 1 } );
-t.ensureIndex( {a : 1} , { "expireAfterSeconds": 50 } )
+t.ensureIndex( {a : 1} , { "expireAfterSeconds": 50 } );
var res = db.runCommand( { "collMod" : coll ,
"usePowerOf2Sizes" : true,
"index" : { "keyPattern" : {a : 1} , "expireAfterSeconds" : 100 } } );
@@ -79,7 +79,7 @@ assert( findTTL( {a:1}, 100), "TTL index should be 100 now" );
// Clear usePowerOf2Sizes and enable noPadding. Make sure collection options.flags is updated.
var res = db.runCommand( { "collMod" : coll ,
"usePowerOf2Sizes" : false,
- "noPadding" : true} )
+ "noPadding" : true} );
debug( res );
assert.commandWorked(res);
var info = findCollectionInfo();
@@ -87,7 +87,7 @@ assert.eq(info.options.flags, 2, tojson(info)); // 2 is CollectionOptions::Flag_
// Clear noPadding and check results object and options.flags.
var res = db.runCommand( { "collMod" : coll ,
- "noPadding" : false} )
+ "noPadding" : false} );
debug( res );
assert.commandWorked(res);
if (!isMongos) {
diff --git a/jstests/core/compact_keeps_indexes.js b/jstests/core/compact_keeps_indexes.js
index 09978004770..68f52c126f5 100644
--- a/jstests/core/compact_keeps_indexes.js
+++ b/jstests/core/compact_keeps_indexes.js
@@ -47,4 +47,4 @@
}
dropCollectionShell();
}
-}())
+}());
diff --git a/jstests/core/connection_string_validation.js b/jstests/core/connection_string_validation.js
index 4ecd1f926ee..a682b27ea79 100644
--- a/jstests/core/connection_string_validation.js
+++ b/jstests/core/connection_string_validation.js
@@ -1,7 +1,7 @@
// Test validation of connection strings passed to the JavaScript "connect()" function.
// Related to SERVER-8030.
-port = "27017"
+port = "27017";
if ( db.getMongo().host.indexOf( ":" ) >= 0 ) {
var idx = db.getMongo().host.indexOf( ":" );
diff --git a/jstests/core/constructors.js b/jstests/core/constructors.js
index 2f75a1fad18..346b1ca0dfc 100644
--- a/jstests/core/constructors.js
+++ b/jstests/core/constructors.js
@@ -26,7 +26,7 @@ function clientEvalConstructorTest (constructorList) {
}
});
constructorList.invalid.forEach(function (constructor) {
- assert.throws(function () { eval(constructor) },
+ assert.throws(function () { eval(constructor); },
[], "invalid constructor did not throw error in eval context: " + constructor);
});
}
@@ -42,7 +42,7 @@ function dbEvalConstructorTest (constructorList) {
}
});
constructorList.invalid.forEach(function (constructor) {
- assert.throws(function () { db.eval(constructor) },
+ assert.throws(function () { db.eval(constructor); },
[], "invalid constructor did not throw error in db.eval context: " + constructor);
});
}
@@ -52,12 +52,12 @@ function mapReduceConstructorTest (constructorList) {
t = db.mr_constructors;
t.drop();
- t.save( { "partner" : 1, "visits" : 9 } )
- t.save( { "partner" : 2, "visits" : 9 } )
- t.save( { "partner" : 1, "visits" : 11 } )
- t.save( { "partner" : 1, "visits" : 30 } )
- t.save( { "partner" : 2, "visits" : 41 } )
- t.save( { "partner" : 2, "visits" : 41 } )
+ t.save( { "partner" : 1, "visits" : 9 } );
+ t.save( { "partner" : 2, "visits" : 9 } );
+ t.save( { "partner" : 1, "visits" : 11 } );
+ t.save( { "partner" : 1, "visits" : 30 } );
+ t.save( { "partner" : 2, "visits" : 41 } );
+ t.save( { "partner" : 2, "visits" : 41 } );
constructorList.valid.forEach(function (constructor) {
try {
@@ -77,7 +77,7 @@ function mapReduceConstructorTest (constructorList) {
r = eval("dummy = function( k , v ){ return { test : " + constructor + " } }");
assert.throws(function () { res = t.mapReduce( m , r ,
- { out : "mr_constructors_out" , scope : { xx : 1 } } ) },
+ { out : "mr_constructors_out" , scope : { xx : 1 } } ); },
[], "invalid constructor did not throw error in mapReduce context: " + constructor);
});
@@ -100,7 +100,7 @@ function whereConstructorTest (constructorList) {
}
});
constructorList.invalid.forEach(function (constructor) {
- assert.throws(function () { t.findOne({ $where : constructor }) },
+ assert.throws(function () { t.findOne({ $where : constructor }); },
[], "invalid constructor did not throw error in $where query: " + constructor);
});
}
@@ -122,7 +122,7 @@ var dbrefConstructors = {
"DBRef(\"namespace\", ObjectId(), true)",
"DBRef(\"namespace\", ObjectId(), 123)",
]
-}
+};
var dbpointerConstructors = {
"valid" : [
@@ -137,7 +137,7 @@ var dbpointerConstructors = {
"DBPointer(\"namespace\")",
"DBPointer(\"namespace\", ObjectId(), true)",
]
-}
+};
var objectidConstructors = {
@@ -149,7 +149,7 @@ var objectidConstructors = {
'ObjectId(5)',
'ObjectId("FFFFFFFFFFFFFFFFFFFFFFFQ")',
]
-}
+};
var timestampConstructors = {
"valid" : [
@@ -167,7 +167,7 @@ var timestampConstructors = {
'Timestamp(true,0)',
'Timestamp(0,true)',
]
-}
+};
var bindataConstructors = {
"valid" : [
@@ -186,7 +186,7 @@ var bindataConstructors = {
'BinData(0, [])',
'BinData(0, function () {})',
]
-}
+};
var uuidConstructors = {
"valid" : [
@@ -205,7 +205,7 @@ var uuidConstructors = {
'UUID([])',
'UUID(function () {})',
]
-}
+};
var md5Constructors = {
"valid" : [
@@ -224,7 +224,7 @@ var md5Constructors = {
'MD5([])',
'MD5(function () {})',
]
-}
+};
var hexdataConstructors = {
"valid" : [
@@ -250,7 +250,7 @@ var hexdataConstructors = {
'HexData(0, function () {})',
'HexData(0, "invalidhex")',
]
-}
+};
var dateConstructors = {
"valid" : [
@@ -262,7 +262,7 @@ var dateConstructors = {
],
"invalid" : [
]
-}
+};
clientEvalConstructorTest(dbrefConstructors);
clientEvalConstructorTest(dbpointerConstructors);
diff --git a/jstests/core/count2.js b/jstests/core/count2.js
index 4d060aaac20..29084306a2f 100644
--- a/jstests/core/count2.js
+++ b/jstests/core/count2.js
@@ -5,22 +5,22 @@ for ( var i=0; i<1000; i++ ){
t.save( { num : i , m : i % 20 } );
}
-assert.eq( 1000 , t.count() , "A" )
-assert.eq( 1000 , t.find().count() , "B" )
-assert.eq( 1000 , t.find().toArray().length , "C" )
+assert.eq( 1000 , t.count() , "A" );
+assert.eq( 1000 , t.find().count() , "B" );
+assert.eq( 1000 , t.find().toArray().length , "C" );
-assert.eq( 50 , t.find( { m : 5 } ).toArray().length , "D" )
-assert.eq( 50 , t.find( { m : 5 } ).count() , "E" )
+assert.eq( 50 , t.find( { m : 5 } ).toArray().length , "D" );
+assert.eq( 50 , t.find( { m : 5 } ).count() , "E" );
-assert.eq( 40 , t.find( { m : 5 } ).skip( 10 ).toArray().length , "F" )
-assert.eq( 50 , t.find( { m : 5 } ).skip( 10 ).count() , "G" )
-assert.eq( 40 , t.find( { m : 5 } ).skip( 10 ).countReturn() , "H" )
+assert.eq( 40 , t.find( { m : 5 } ).skip( 10 ).toArray().length , "F" );
+assert.eq( 50 , t.find( { m : 5 } ).skip( 10 ).count() , "G" );
+assert.eq( 40 , t.find( { m : 5 } ).skip( 10 ).countReturn() , "H" );
-assert.eq( 20 , t.find( { m : 5 } ).skip( 10 ).limit(20).toArray().length , "I" )
-assert.eq( 50 , t.find( { m : 5 } ).skip( 10 ).limit(20).count() , "J" )
-assert.eq( 20 , t.find( { m : 5 } ).skip( 10 ).limit(20).countReturn() , "K" )
+assert.eq( 20 , t.find( { m : 5 } ).skip( 10 ).limit(20).toArray().length , "I" );
+assert.eq( 50 , t.find( { m : 5 } ).skip( 10 ).limit(20).count() , "J" );
+assert.eq( 20 , t.find( { m : 5 } ).skip( 10 ).limit(20).countReturn() , "K" );
-assert.eq( 5 , t.find( { m : 5 } ).skip( 45 ).limit(20).countReturn() , "L" )
+assert.eq( 5 , t.find( { m : 5 } ).skip( 45 ).limit(20).countReturn() , "L" );
// Negative skip values should return error
var negSkipResult = db.runCommand({ count: 't', skip : -2 });
diff --git a/jstests/core/count4.js b/jstests/core/count4.js
index 7be74362603..11a43afbb01 100644
--- a/jstests/core/count4.js
+++ b/jstests/core/count4.js
@@ -6,7 +6,7 @@ for ( i=0; i<100; i++ ){
t.save( { x : i } );
}
-q = { x : { $gt : 25 , $lte : 75 } }
+q = { x : { $gt : 25 , $lte : 75 } };
assert.eq( 50 , t.find( q ).count() , "A" );
assert.eq( 50 , t.find( q ).itcount() , "B" );
diff --git a/jstests/core/counta.js b/jstests/core/counta.js
index 94e5889b1fe..eadec40f4a1 100644
--- a/jstests/core/counta.js
+++ b/jstests/core/counta.js
@@ -14,6 +14,6 @@ assert.throws(
} );
// count must return error if collection name is absent
-res=db.runCommand("count")
-assert.eq(res.ok, 0) // must not be OK
-assert(res.code == 2) // should fail with errorcode("BadValue"), not an massert
+res=db.runCommand("count");
+assert.eq(res.ok, 0); // must not be OK
+assert(res.code == 2); // should fail with errorcode("BadValue"), not an massert
diff --git a/jstests/core/coveredIndex1.js b/jstests/core/coveredIndex1.js
index 54ef179f2b1..434988b3b30 100644
--- a/jstests/core/coveredIndex1.js
+++ b/jstests/core/coveredIndex1.js
@@ -5,12 +5,12 @@ t.drop();
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-t.save({fn: "john", ln: "doe"})
-t.save({fn: "jack", ln: "doe"})
-t.save({fn: "john", ln: "smith"})
-t.save({fn: "jack", ln: "black"})
-t.save({fn: "bob", ln: "murray"})
-t.save({fn: "aaa", ln: "bbb", obj: {a: 1, b: "blah"}})
+t.save({fn: "john", ln: "doe"});
+t.save({fn: "jack", ln: "doe"});
+t.save({fn: "john", ln: "smith"});
+t.save({fn: "jack", ln: "black"});
+t.save({fn: "bob", ln: "murray"});
+t.save({fn: "aaa", ln: "bbb", obj: {a: 1, b: "blah"}});
assert.eq( t.findOne({ln: "doe"}).fn, "john", "Cannot find right record" );
assert.eq( t.count(), 6, "Not right length" );
@@ -30,7 +30,7 @@ assert( isIndexOnly(t.find({}, {ln: 1, _id: 0}).hint({ln: 1}).explain().queryPla
"Find is not using covered index");
// use compound index
-t.dropIndex({ln: 1})
+t.dropIndex({ln: 1});
t.ensureIndex({ln: 1, fn: 1});
// return 1 field
var plan = t.find({ln: "doe"}, {ln: 1, _id: 0}).explain();
@@ -50,7 +50,7 @@ assert( !isIndexOnly(plan.queryPlanner.winningPlan),
"Find is using covered index, but doesnt have 1st key");
// repeat above but with _id field
-t.dropIndex({ln: 1, fn: 1})
+t.dropIndex({ln: 1, fn: 1});
t.ensureIndex({_id: 1, ln: 1});
// return 1 field
var plan = t.find({_id: 123, ln: "doe"}, {_id: 1}).explain();
@@ -67,7 +67,7 @@ assert( !isIndexOnly(plan.queryPlanner.winningPlan),
"Find is using covered index, but doesnt have 1st key");
// repeat above but with embedded obj
-t.dropIndex({_id: 1, ln: 1})
+t.dropIndex({_id: 1, ln: 1});
t.ensureIndex({obj: 1});
var plan = t.find({"obj.a": 1}, {obj: 1}).explain();
assert( !isIndexOnly(plan.queryPlanner.winningPlan),
@@ -79,8 +79,8 @@ assert( isIndexOnly(plan.queryPlanner.winningPlan), "Find is not using covered i
// repeat above but with index on sub obj field
t.dropIndex({obj: 1});
-t.ensureIndex({"obj.a": 1, "obj.b": 1})
-var plan = t.find({"obj.a": 1}, {obj: 1}).explain()
+t.ensureIndex({"obj.a": 1, "obj.b": 1});
+var plan = t.find({"obj.a": 1}, {obj: 1}).explain();
assert( !isIndexOnly(plan.queryPlanner.winningPlan),
"Shouldnt use index when introspecting object");
diff --git a/jstests/core/coveredIndex2.js b/jstests/core/coveredIndex2.js
index 6abb280e422..0f26037bf43 100644
--- a/jstests/core/coveredIndex2.js
+++ b/jstests/core/coveredIndex2.js
@@ -4,8 +4,8 @@ t.drop();
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-t.save({a: 1})
-t.save({a: 2})
+t.save({a: 1});
+t.save({a: 2});
assert.eq( t.findOne({a: 1}).a, 1, "Cannot find right record" );
assert.eq( t.count(), 2, "Not right length" );
@@ -22,7 +22,7 @@ assert( isIndexOnly(plan.queryPlanner.winningPlan),
"Find is not using covered index");
// add multikey
-t.save({a:[3,4]})
+t.save({a:[3,4]});
var plan = t.find({a:1}, {a: 1, _id: 0}).explain();
assert( !isIndexOnly(plan.queryPlanner.winningPlan),
"Find is using covered index even after multikey insert");
diff --git a/jstests/core/covered_index_compound_1.js b/jstests/core/covered_index_compound_1.js
index 9090f3168cd..ffe01646ba7 100644
--- a/jstests/core/covered_index_compound_1.js
+++ b/jstests/core/covered_index_compound_1.js
@@ -3,72 +3,72 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_compound_1")
-coll.drop()
+var coll = db.getCollection("covered_compound_1");
+coll.drop();
for (i=0;i<100;i++) {
- coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10)})
+ coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10)});
}
-coll.ensureIndex({a:1,b:-1,c:1})
+coll.ensureIndex({a:1,b:-1,c:1});
// Test equality - all indexed fields queried and projected
var plan = coll.find({a:10, b:"strvar_10", c:0}, {a:1, b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.1 - indexOnly should be true on covered query")
+ "compound.1.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.1 - nscannedObjects should be 0 for covered query")
+ "compound.1.1 - nscannedObjects should be 0 for covered query");
// Test query on subset of fields queried and project all
var plan = coll.find({a:26, b:"strvar_0"}, {a:1, b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.2 - indexOnly should be true on covered query")
+ "compound.1.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.2 - nscannedObjects should be 0 for covered query")
+ "compound.1.2 - nscannedObjects should be 0 for covered query");
// Test query on all fields queried and project subset
var plan = coll.find({a:38, b:"strvar_12", c: 8}, {b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.3 - indexOnly should be true on covered query")
+ "compound.1.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.3 - nscannedObjects should be 0 for covered query")
+ "compound.1.3 - nscannedObjects should be 0 for covered query");
// Test no query
var plan = coll.find({}, {b:1, c:1, _id:0}).hint({a:1, b:-1, c:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.4 - indexOnly should be true on covered query")
+ "compound.1.4 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.4 - nscannedObjects should be 0 for covered query")
+ "compound.1.4 - nscannedObjects should be 0 for covered query");
// Test range query
var plan = coll.find({a:{$gt:25,$lt:43}}, {b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.5 - indexOnly should be true on covered query")
+ "compound.1.5 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.5 - nscannedObjects should be 0 for covered query")
+ "compound.1.5 - nscannedObjects should be 0 for covered query");
// Test in query
var plan = coll.find({a:38, b:"strvar_12", c:{$in:[5,8]}}, {b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.6 - indexOnly should be true on covered query")
+ "compound.1.6 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.6 - nscannedObjects should be 0 for covered query")
+ "compound.1.6 - nscannedObjects should be 0 for covered query");
// Test no result
var plan = coll.find({a:38, b:"strvar_12", c:55},{a:1, b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "compound.1.7 - indexOnly should be true on covered query")
+ "compound.1.7 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "compound.1.7 - nscannedObjects should be 0 for covered query")
+ "compound.1.7 - nscannedObjects should be 0 for covered query");
-print('all tests passed')
+print('all tests passed');
diff --git a/jstests/core/covered_index_negative_1.js b/jstests/core/covered_index_negative_1.js
index b2ab81b37cc..8afd03f2a58 100644
--- a/jstests/core/covered_index_negative_1.js
+++ b/jstests/core/covered_index_negative_1.js
@@ -6,46 +6,46 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_negative_1")
-coll.drop()
+var coll = db.getCollection("covered_negative_1");
+coll.drop();
for (i=0;i<100;i++) {
coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10), d: i*10, e: [i, i%10],
- f:i})
+ f:i});
}
-coll.ensureIndex({a:1,b:-1,c:1})
-coll.ensureIndex({e:1})
-coll.ensureIndex({d:1})
-coll.ensureIndex({f:"hashed"})
+coll.ensureIndex({a:1,b:-1,c:1});
+coll.ensureIndex({e:1});
+coll.ensureIndex({d:1});
+coll.ensureIndex({f:"hashed"});
// Test no projection
var plan = coll.find({a:10, b:"strvar_10", c:0}).hint({a:1, b:-1, c:1}).explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.1 - indexOnly should be false on a non covered query")
+ "negative.1.1 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.1 - docs examined should not be 0 for a non covered query")
+ "negative.1.1 - docs examined should not be 0 for a non covered query");
// Test projection and not excluding _id
var plan = coll.find({a:10, b:"strvar_10", c:0},{a:1, b:1, c:1})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.2 - indexOnly should be false on a non covered query")
+ "negative.1.2 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.2 - docs examined should not be 0 for a non covered query")
+ "negative.1.2 - docs examined should not be 0 for a non covered query");
// Test projection of non-indexed field
var plan = coll.find({d:100},{d:1, c:1, _id:0}).hint({d:1}).explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.3 - indexOnly should be false on a non covered query")
+ "negative.1.3 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.3 - docs examined should not be 0 for a non covered query")
+ "negative.1.3 - docs examined should not be 0 for a non covered query");
// Test query and projection on a multi-key index
var plan = coll.find({e:99},{e:1, _id:0}).hint({e:1}).explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.4 - indexOnly should be false on a non covered query")
+ "negative.1.4 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.4 - docs examined should not be 0 for a non covered query")
+ "negative.1.4 - docs examined should not be 0 for a non covered query");
// Commenting out negative.1.5 and 1.6 pending fix in SERVER-8650
// // Test projection and $natural sort
@@ -65,15 +65,15 @@ var plan = coll.find({d:{$lt:1000}},{a:1, b:1, c:1, _id:0})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.7 - indexOnly should be false on a non covered query")
+ "negative.1.7 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.7 - docs examined should not be 0 for a non covered query")
+ "negative.1.7 - docs examined should not be 0 for a non covered query");
// Test query on hashed indexed field
var plan = coll.find({f:10},{f:1, _id:0}).hint({f:"hashed"}).explain("executionStats");
assert(!isIndexOnly(plan.queryPlanner.winningPlan),
- "negative.1.8 - indexOnly should be false on a non covered query")
+ "negative.1.8 - indexOnly should be false on a non covered query");
assert.neq(0, plan.executionStats.totalDocsExamined,
- "negative.1.8 - nscannedObjects should not be 0 for a non covered query")
+ "negative.1.8 - nscannedObjects should not be 0 for a non covered query");
-print('all tests passed')
+print('all tests passed');
diff --git a/jstests/core/covered_index_simple_1.js b/jstests/core/covered_index_simple_1.js
index 3edde455754..25badb1601f 100644
--- a/jstests/core/covered_index_simple_1.js
+++ b/jstests/core/covered_index_simple_1.js
@@ -3,69 +3,69 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_simple_1")
-coll.drop()
+var coll = db.getCollection("covered_simple_1");
+coll.drop();
for (i=0;i<10;i++) {
- coll.insert({foo:i})
+ coll.insert({foo:i});
}
for (i=0;i<10;i++) {
- coll.insert({foo:i})
+ coll.insert({foo:i});
}
for (i=0;i<5;i++) {
- coll.insert({bar:i})
+ coll.insert({bar:i});
}
-coll.insert({foo:"string"})
-coll.insert({foo:{bar:1}})
-coll.insert({foo:null})
-coll.ensureIndex({foo:1})
+coll.insert({foo:"string"});
+coll.insert({foo:{bar:1}});
+coll.insert({foo:null});
+coll.ensureIndex({foo:1});
// Test equality with int value
var plan = coll.find({foo:1}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.1 - indexOnly should be true on covered query")
+ "simple.1.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.1 - docs examined should be 0 for covered query")
+ "simple.1.1 - docs examined should be 0 for covered query");
// Test equality with string value
var plan = coll.find({foo:"string"}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.2 - indexOnly should be true on covered query")
+ "simple.1.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.2 - docs examined should be 0 for covered query")
+ "simple.1.2 - docs examined should be 0 for covered query");
// Test equality with doc value
var plan = coll.find({foo:{bar:1}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.3 - indexOnly should be true on covered query")
+ "simple.1.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.3 - docs examined should be 0 for covered query")
+ "simple.1.3 - docs examined should be 0 for covered query");
// Test no query
var plan = coll.find({}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.4 - indexOnly should be true on covered query")
+ "simple.1.4 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.4 - docs examined should be 0 for covered query")
+ "simple.1.4 - docs examined should be 0 for covered query");
// Test range query
var plan = coll.find({foo:{$gt:2,$lt:6}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.5 - indexOnly should be true on covered query")
+ "simple.1.5 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.5 - docs examined should be 0 for covered query")
+ "simple.1.5 - docs examined should be 0 for covered query");
// Test in query
var plan = coll.find({foo:{$in:[5,8]}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.6 - indexOnly should be true on covered query")
+ "simple.1.6 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.6 - docs examined should be 0 for covered query")
+ "simple.1.6 - docs examined should be 0 for covered query");
// Test no return
var plan = coll.find({foo:"2"}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.1.7 - indexOnly should be true on covered query")
+ "simple.1.7 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.1.7 - nscannedObjects should be 0 for covered query")
+ "simple.1.7 - nscannedObjects should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_simple_2.js b/jstests/core/covered_index_simple_2.js
index 7ca05b3f461..f666a9eb4ae 100644
--- a/jstests/core/covered_index_simple_2.js
+++ b/jstests/core/covered_index_simple_2.js
@@ -3,56 +3,56 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_simple_2")
-coll.drop()
+var coll = db.getCollection("covered_simple_2");
+coll.drop();
for (i=0;i<10;i++) {
- coll.insert({foo:i})
+ coll.insert({foo:i});
}
-coll.insert({foo:"string"})
-coll.insert({foo:{bar:1}})
-coll.insert({foo:null})
-coll.ensureIndex({foo:1},{unique:true})
+coll.insert({foo:"string"});
+coll.insert({foo:{bar:1}});
+coll.insert({foo:null});
+coll.ensureIndex({foo:1},{unique:true});
// Test equality with int value
var plan = coll.find({foo:1}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.1 - indexOnly should be true on covered query")
+ "simple.2.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.2.1 - docs examined should be 0 for covered query")
+ "simple.2.1 - docs examined should be 0 for covered query");
// Test equality with string value
var plan = coll.find({foo:"string"}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.2 - indexOnly should be true on covered query")
+ "simple.2.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.2.2 - docs examined should be 0 for covered query")
+ "simple.2.2 - docs examined should be 0 for covered query");
// Test equality with int value on a dotted field
var plan = coll.find({foo:{bar:1}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.3 - indexOnly should be true on covered query")
+ "simple.2.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
"simple.2.3 - docs examined should be 0 for covered query");
// Test no query
var plan = coll.find({}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.4 - indexOnly should be true on covered query")
+ "simple.2.4 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
"simple.2.4 - docs examined should be 0 for covered query");
// Test range query
var plan = coll.find({foo:{$gt:2,$lt:6}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.5 - indexOnly should be true on covered query")
+ "simple.2.5 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
"simple.2.5 - docs examined should be 0 for covered query");
// Test in query
var plan = coll.find({foo:{$in:[5,8]}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.2.6 - indexOnly should be true on covered query")
+ "simple.2.6 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
"simple.2.6 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_simple_3.js b/jstests/core/covered_index_simple_3.js
index 88293fe68bd..5338f4bd782 100644
--- a/jstests/core/covered_index_simple_3.js
+++ b/jstests/core/covered_index_simple_3.js
@@ -19,59 +19,59 @@ coll.ensureIndex({foo:1}, {sparse:true, unique:true});
// Test equality with int value
var plan = coll.find({foo:1}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.1 - indexOnly should be true on covered query")
+ "simple.3.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.1 - docs examined should be 0 for covered query")
+ "simple.3.1 - docs examined should be 0 for covered query");
// Test equality with string value
var plan = coll.find({foo:"string"}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.2 - indexOnly should be true on covered query")
+ "simple.3.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.2 - docs examined should be 0 for covered query")
+ "simple.3.2 - docs examined should be 0 for covered query");
// Test equality with int value on a dotted field
var plan = coll.find({foo:{bar:1}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.3 - indexOnly should be true on covered query")
+ "simple.3.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.3 - docs examined should be 0 for covered query")
+ "simple.3.3 - docs examined should be 0 for covered query");
// Test no query
var plan = coll.find({}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.4 - indexOnly should be true on covered query")
+ "simple.3.4 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.4 - docs examined should be 0 for covered query")
+ "simple.3.4 - docs examined should be 0 for covered query");
// Test range query
var plan = coll.find({foo:{$gt:2,$lt:6}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.5 - indexOnly should be true on covered query")
+ "simple.3.5 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.5 - docs examined should be 0 for covered query")
+ "simple.3.5 - docs examined should be 0 for covered query");
// Test in query
var plan = coll.find({foo:{$in:[5,8]}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.6 - indexOnly should be true on covered query")
+ "simple.3.6 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.6 - docs examined should be 0 for covered query")
+ "simple.3.6 - docs examined should be 0 for covered query");
// Test $exists true
var plan = coll.find({foo:{$exists:true}}, {foo:1, _id:0}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.7 - indexOnly should be true on covered query")
+ "simple.3.7 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.7 - docs examined should be 0 for covered query")
+ "simple.3.7 - docs examined should be 0 for covered query");
// Check that $nin can be covered.
coll.dropIndexes();
coll.ensureIndex({bar: 1});
var plan = coll.find({bar:{$nin:[5,8]}}, {bar:1, _id:0}).hint({bar:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.3.8 - indexOnly should be true on covered query")
+ "simple.3.8 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.3.8 - docs examined should be 0 for covered query")
+ "simple.3.8 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_simple_id.js b/jstests/core/covered_index_simple_id.js
index 3677e42056d..d6db2c3149f 100644
--- a/jstests/core/covered_index_simple_id.js
+++ b/jstests/core/covered_index_simple_id.js
@@ -3,55 +3,55 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_simple_id")
-coll.drop()
+var coll = db.getCollection("covered_simple_id");
+coll.drop();
for (i=0;i<10;i++) {
- coll.insert({_id:i})
+ coll.insert({_id:i});
}
-coll.insert({_id:"string"})
-coll.insert({_id:{bar:1}})
-coll.insert({_id:null})
+coll.insert({_id:"string"});
+coll.insert({_id:{bar:1}});
+coll.insert({_id:null});
// Test equality with int value
var plan = coll.find({_id:1}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.1 - indexOnly should be true on covered query")
+ "simple.id.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.1 - docs examined should be 0 for covered query")
+ "simple.id.1 - docs examined should be 0 for covered query");
// Test equality with string value
var plan = coll.find({_id:"string"}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.2 - indexOnly should be true on covered query")
+ "simple.id.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.2 - docs examined should be 0 for covered query")
+ "simple.id.2 - docs examined should be 0 for covered query");
// Test equality with int value on a dotted field
var plan = coll.find({_id:{bar:1}}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.3 - indexOnly should be true on covered query")
+ "simple.id.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.3 - docs examined should be 0 for covered query")
+ "simple.id.3 - docs examined should be 0 for covered query");
// Test no query
var plan = coll.find({}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.4 - indexOnly should be true on covered query")
+ "simple.id.4 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.4 - docs examined should be 0 for covered query")
+ "simple.id.4 - docs examined should be 0 for covered query");
// Test range query
var plan = coll.find({_id:{$gt:2,$lt:6}}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.5 - indexOnly should be true on covered query")
+ "simple.id.5 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.5 - docs examined should be 0 for covered query")
+ "simple.id.5 - docs examined should be 0 for covered query");
// Test in query
var plan = coll.find({_id:{$in:[5,8]}}, {_id:1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "simple.id.6 - indexOnly should be true on covered query")
+ "simple.id.6 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "simple.id.6 - docs examined should be 0 for covered query")
+ "simple.id.6 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_sort_1.js b/jstests/core/covered_index_sort_1.js
index d8b301ae3aa..3ddd9e7b701 100644
--- a/jstests/core/covered_index_sort_1.js
+++ b/jstests/core/covered_index_sort_1.js
@@ -3,43 +3,43 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_sort_1")
-coll.drop()
+var coll = db.getCollection("covered_sort_1");
+coll.drop();
for (i=0;i<10;i++) {
- coll.insert({foo:i})
+ coll.insert({foo:i});
}
for (i=0;i<10;i++) {
- coll.insert({foo:i})
+ coll.insert({foo:i});
}
for (i=0;i<5;i++) {
- coll.insert({bar:i})
+ coll.insert({bar:i});
}
-coll.insert({foo:"1"})
-coll.insert({foo:{bar:1}})
-coll.insert({foo:null})
-coll.ensureIndex({foo:1})
+coll.insert({foo:"1"});
+coll.insert({foo:{bar:1}});
+coll.insert({foo:null});
+coll.ensureIndex({foo:1});
// Test no query and sort ascending
var plan = coll.find({}, {foo:1, _id:0}).sort({foo:1}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "sort.1.1 - indexOnly should be true on covered query")
+ "sort.1.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "sort.1.1 - docs examined should be 0 for covered query")
+ "sort.1.1 - docs examined should be 0 for covered query");
// Test no query and sort descending
var plan = coll.find({}, {foo:1, _id:0}).sort({foo:-1}).hint({foo:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "sort.1.2 - indexOnly should be true on covered query")
+ "sort.1.2 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "sort.1.2 - docs examined should be 0 for covered query")
+ "sort.1.2 - docs examined should be 0 for covered query");
// Test range query with sort
var plan = coll.find({foo:{$gt:2}}, {foo:1, _id:0}).sort({foo:-1})
.hint({foo:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "sort.1.3 - indexOnly should be true on covered query")
+ "sort.1.3 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "sort.1.3 - docs examined should be 0 for covered query")
+ "sort.1.3 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_sort_2.js b/jstests/core/covered_index_sort_2.js
index fc438b21554..75a89ee7618 100644
--- a/jstests/core/covered_index_sort_2.js
+++ b/jstests/core/covered_index_sort_2.js
@@ -3,20 +3,20 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_sort_2")
-coll.drop()
+var coll = db.getCollection("covered_sort_2");
+coll.drop();
for (i=0;i<10;i++) {
- coll.insert({_id:i})
+ coll.insert({_id:i});
}
-coll.insert({_id:"1"})
-coll.insert({_id:{bar:1}})
-coll.insert({_id:null})
+coll.insert({_id:"1"});
+coll.insert({_id:{bar:1}});
+coll.insert({_id:null});
// Test no query
var plan = coll.find({}, {_id:1}).sort({_id:-1}).hint({_id:1}).explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "sort.2.1 - indexOnly should be true on covered query")
+ "sort.2.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "sort.2.1 - docs examined should be 0 for covered query")
+ "sort.2.1 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/covered_index_sort_3.js b/jstests/core/covered_index_sort_3.js
index e87e6d0dff3..735b93877ba 100644
--- a/jstests/core/covered_index_sort_3.js
+++ b/jstests/core/covered_index_sort_3.js
@@ -3,21 +3,21 @@
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-var coll = db.getCollection("covered_sort_3")
-coll.drop()
+var coll = db.getCollection("covered_sort_3");
+coll.drop();
for (i=0;i<100;i++) {
- coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10)})
+ coll.insert({a:i, b:"strvar_"+(i%13), c:NumberInt(i%10)});
}
-coll.insert
-coll.ensureIndex({a:1,b:-1,c:1})
+coll.insert;
+coll.ensureIndex({a:1,b:-1,c:1});
// Test no query, sort on all fields in index order
var plan = coll.find({}, {b:1, c:1, _id:0}).sort({a:1,b:-1,c:1})
.hint({a:1, b:-1, c:1})
.explain("executionStats");
assert(isIndexOnly(plan.queryPlanner.winningPlan),
- "sort.3.1 - indexOnly should be true on covered query")
+ "sort.3.1 - indexOnly should be true on covered query");
assert.eq(0, plan.executionStats.totalDocsExamined,
- "sort.3.1 - docs examined should be 0 for covered query")
+ "sort.3.1 - docs examined should be 0 for covered query");
-print ('all tests pass')
+print ('all tests pass');
diff --git a/jstests/core/create_indexes.js b/jstests/core/create_indexes.js
index ef11187f76a..f86208ec3b0 100644
--- a/jstests/core/create_indexes.js
+++ b/jstests/core/create_indexes.js
@@ -110,19 +110,19 @@
assert.eq( 5, t.getIndexes().length );
res = t.runCommand( "createIndexes",
- { indexes : [ { key : { "c" : 1 }, sparse : true, name : "c_1" } ] } )
+ { indexes : [ { key : { "c" : 1 }, sparse : true, name : "c_1" } ] } );
assert.eq( 6, t.getIndexes().length );
assert.eq( 1, t.getIndexes().filter( function(z){ return z.sparse; } ).length );
res = t.runCommand( "createIndexes",
{ indexes : [ { key : { "x" : "foo" }, name : "x_1" } ] } );
- assert( !res.ok )
+ assert( !res.ok );
assert.eq( 6, t.getIndexes().length );
res = t.runCommand( "createIndexes",
{ indexes : [ { key : { "x" : 1 }, name : "" } ] } );
- assert( !res.ok )
+ assert( !res.ok );
assert.eq( 6, t.getIndexes().length );
diff --git a/jstests/core/crud_api.js b/jstests/core/crud_api.js
index 2e696f7c615..0c248884350 100644
--- a/jstests/core/crud_api.js
+++ b/jstests/core/crud_api.js
@@ -24,7 +24,7 @@
var results = coll.find({}).sort({_id: 1}).toArray();
assert.docEq(args.expected, results);
- }
+ };
}
function checkResultObject(first, second) {
@@ -732,16 +732,16 @@
// Drop collection
coll.drop();
- coll.ensureIndex({a:1}, {unique:true})
+ coll.ensureIndex({a:1}, {unique:true});
// Should throw duplicate key error
assert.throws(function() {
- coll.insertMany([{a:0, b:0}, {a:0, b:1}])
+ coll.insertMany([{a:0, b:0}, {a:0, b:1}]);
});
assert(coll.findOne({a:0, b:0}) != null);
assert.throws(function() {
- coll.insertOne({a:0, b:0})
+ coll.insertOne({a:0, b:0});
});
assert.throws(function() {
@@ -765,7 +765,7 @@
{ insertOne: { document: { _id: 4, a: 0 } } }
]);
});
- }
+ };
crudAPISpecTests();
})();
diff --git a/jstests/core/currentop.js b/jstests/core/currentop.js
index c84556226cd..34e96696481 100644
--- a/jstests/core/currentop.js
+++ b/jstests/core/currentop.js
@@ -1,7 +1,7 @@
print("BEGIN currentop.js");
// test basic currentop functionality + querying of nested documents
-t = db.jstests_currentop
+t = db.jstests_currentop;
t.drop();
for(i=0;i<100;i++) {
@@ -24,12 +24,12 @@ print("sleep");
sleep(1000);
print("inprog:");
-printjson(db.currentOp().inprog)
-print()
+printjson(db.currentOp().inprog);
+print();
sleep(1);
print("inprog:");
-printjson(db.currentOp().inprog)
-print()
+printjson(db.currentOp().inprog);
+print();
// need to wait for read to start
print("wait have some ops");
diff --git a/jstests/core/cursor1.js b/jstests/core/cursor1.js
index 8448752bb0c..65c62e64f91 100644
--- a/jstests/core/cursor1.js
+++ b/jstests/core/cursor1.js
@@ -1,5 +1,5 @@
-t = db.cursor1
+t = db.cursor1;
t.drop();
big = "";
diff --git a/jstests/core/cursor3.js b/jstests/core/cursor3.js
index d23264c94ba..fb1d95afb18 100644
--- a/jstests/core/cursor3.js
+++ b/jstests/core/cursor3.js
@@ -11,7 +11,7 @@ function checkResults( expected, cursor , testNum ) {
}
t = db.cursor3;
-t.drop()
+t.drop();
t.save( { a: 0 } );
t.save( { a: 1 } );
@@ -21,15 +21,15 @@ t.ensureIndex( { a: 1 } );
-checkResults( [ 1 ], t.find( { a: 1 } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 1 ], t.find( { a: 1 } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ )
+checkResults( [ 1 ], t.find( { a: 1 } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 1 ], t.find( { a: 1 } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ );
-checkResults( [ 1, 2 ], t.find( { a: { $gt: 0 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 2, 1 ], t.find( { a: { $gt: 0 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 1, 2 ], t.find( { a: { $gte: 1 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 2, 1 ], t.find( { a: { $gte: 1 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ )
+checkResults( [ 1, 2 ], t.find( { a: { $gt: 0 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 2, 1 ], t.find( { a: { $gt: 0 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 1, 2 ], t.find( { a: { $gte: 1 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 2, 1 ], t.find( { a: { $gte: 1 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ );
-checkResults( [ 0, 1 ], t.find( { a: { $lt: 2 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 1, 0 ], t.find( { a: { $lt: 2 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 0, 1 ], t.find( { a: { $lte: 1 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ )
-checkResults( [ 1, 0 ], t.find( { a: { $lte: 1 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ )
+checkResults( [ 0, 1 ], t.find( { a: { $lt: 2 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 1, 0 ], t.find( { a: { $lt: 2 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 0, 1 ], t.find( { a: { $lte: 1 } } ).sort( { a: 1 } ).hint( { a: 1 } ) , testNum++ );
+checkResults( [ 1, 0 ], t.find( { a: { $lte: 1 } } ).sort( { a: -1 } ).hint( { a: 1 } ) , testNum++ );
diff --git a/jstests/core/cursora.js b/jstests/core/cursora.js
index 3e565c4835e..0a69c4e5592 100644
--- a/jstests/core/cursora.js
+++ b/jstests/core/cursora.js
@@ -1,4 +1,4 @@
-t = db.cursora
+t = db.cursora;
function run( n , atomic ){
if( !isNumber(n) ) {
@@ -6,14 +6,14 @@ function run( n , atomic ){
printjson(n);
assert(isNumber(n), "cursora.js isNumber");
}
- t.drop()
+ t.drop();
var bulk = t.initializeUnorderedBulkOp();
for ( i=0; i<n; i++ )
bulk.insert( { _id : i } );
assert.writeOK(bulk.execute());
- print("cursora.js startParallelShell n:"+n+" atomic:"+atomic)
+ print("cursora.js startParallelShell n:"+n+" atomic:"+atomic);
join = startParallelShell( "sleep(50);" +
"db.cursora.remove({" + ( atomic ? "$atomic:true" : "" ) + "});" );
@@ -22,13 +22,13 @@ function run( n , atomic ){
var num = null;
var end = null;
try {
- start = new Date()
+ start = new Date();
num = t.find(function () {
num = 2;
for (var x = 0; x < 1000; x++) num += 2;
return num > 0;
}).sort({ _id: -1 }).itcount();
- end = new Date()
+ end = new Date();
}
catch (e) {
print("cursora.js FAIL " + e);
@@ -36,17 +36,17 @@ function run( n , atomic ){
throw e;
}
- join()
+ join();
//print( "cursora.js num: " + num + " time:" + ( end.getTime() - start.getTime() ) )
- assert.eq( 0 , t.count() , "after remove: " + tojson( ex ) )
+ assert.eq( 0 , t.count() , "after remove: " + tojson( ex ) );
// assert.lt( 0 , ex.nYields , "not enough yields : " + tojson( ex ) ); // TODO make this more reliable so cen re-enable assert
if ( n == num )
print( "cursora.js warning: shouldn't have counted all n: " + n + " num: " + num );
}
-run( 1500 )
-run( 5000 )
-run( 1500 , true )
-run( 5000 , true )
-print("cursora.js SUCCESS")
+run( 1500 );
+run( 5000 );
+run( 1500 , true );
+run( 5000 , true );
+print("cursora.js SUCCESS");
diff --git a/jstests/core/cursorb.js b/jstests/core/cursorb.js
index 65e356e89cb..70f49c50454 100644
--- a/jstests/core/cursorb.js
+++ b/jstests/core/cursorb.js
@@ -12,6 +12,6 @@ t.find().itcount();
// Check that the 'cursor not found in map -1' message is not printed. This message indicates an
// attempt to look up a cursor with an invalid id and should never appear in the log.
-log = db.adminCommand( { getLog:'global' } ).log
+log = db.adminCommand( { getLog:'global' } ).log;
log.forEach( function( line ) { assert( !line.match( /cursor not found in map -1 / ),
'Cursor map lookup with id -1.' ); } );
diff --git a/jstests/core/datasize2.js b/jstests/core/datasize2.js
index 103cb2096ee..b189b361e44 100644
--- a/jstests/core/datasize2.js
+++ b/jstests/core/datasize2.js
@@ -1,8 +1,8 @@
-t = db.datasize2
+t = db.datasize2;
t.drop();
-N = 1000
+N = 1000;
for ( i=0; i<N; i++ ){
t.insert( { _id : i , s : "asdasdasdasdasdasdasd" } );
}
@@ -20,8 +20,8 @@ c = { dataSize : "test.datasize2" ,
};
-assert.eq( N , db.runCommand( c ).numObjects , "A" )
+assert.eq( N , db.runCommand( c ).numObjects , "A" );
c.maxObjects = 100;
-assert.eq( 101 , db.runCommand( c ).numObjects , "B" )
+assert.eq( 101 , db.runCommand( c ).numObjects , "B" );
diff --git a/jstests/core/date1.js b/jstests/core/date1.js
index e6fc147f9f4..7e893ea1355 100644
--- a/jstests/core/date1.js
+++ b/jstests/core/date1.js
@@ -7,11 +7,11 @@ function go( d , msg ){
t.save({ a: 1, d: d });
// printjson(d);
// printjson(t.findOne().d);
- assert.eq( d , t.findOne().d , msg )
+ assert.eq( d , t.findOne().d , msg );
}
-go( new Date() , "A" )
-go( new Date( 1 ) , "B")
-go( new Date( 0 ) , "C (old spidermonkey lib fails this test)")
-go(new Date(-10), "neg")
+go( new Date() , "A" );
+go( new Date( 1 ) , "B");
+go( new Date( 0 ) , "C (old spidermonkey lib fails this test)");
+go(new Date(-10), "neg");
diff --git a/jstests/core/date3.js b/jstests/core/date3.js
index e7ddf717c73..8329cca0dfe 100644
--- a/jstests/core/date3.js
+++ b/jstests/core/date3.js
@@ -1,31 +1,31 @@
// Check dates before Unix epoch - SERVER-405
t = db.date3;
-t.drop()
+t.drop();
-d1 = new Date(-1000)
-dz = new Date(0)
-d2 = new Date(1000)
+d1 = new Date(-1000);
+dz = new Date(0);
+d2 = new Date(1000);
-t.save( {x: 3, d: dz} )
-t.save( {x: 2, d: d2} )
-t.save( {x: 1, d: d1} )
+t.save( {x: 3, d: dz} );
+t.save( {x: 2, d: d2} );
+t.save( {x: 1, d: d1} );
function test () {
- var list = t.find( {d: {$lt: dz}} )
- assert.eq ( 1, list.size() )
- assert.eq ( 1, list[0].x )
- assert.eq ( d1, list[0].d )
- var list = t.find( {d: {$gt: dz}} )
- assert.eq ( 1, list.size() )
- assert.eq ( 2, list[0].x )
- var list = t.find().sort( {d:1} )
- assert.eq ( 3, list.size() )
- assert.eq ( 1, list[0].x )
- assert.eq ( 3, list[1].x )
- assert.eq ( 2, list[2].x )
+ var list = t.find( {d: {$lt: dz}} );
+ assert.eq ( 1, list.size() );
+ assert.eq ( 1, list[0].x );
+ assert.eq ( d1, list[0].d );
+ var list = t.find( {d: {$gt: dz}} );
+ assert.eq ( 1, list.size() );
+ assert.eq ( 2, list[0].x );
+ var list = t.find().sort( {d:1} );
+ assert.eq ( 3, list.size() );
+ assert.eq ( 1, list[0].x );
+ assert.eq ( 3, list[1].x );
+ assert.eq ( 2, list[2].x );
}
-test()
-t.ensureIndex( {d: 1} )
-test()
+test();
+t.ensureIndex( {d: 1} );
+test();
diff --git a/jstests/core/dbadmin.js b/jstests/core/dbadmin.js
index b287a9ba58c..7b56a468d75 100644
--- a/jstests/core/dbadmin.js
+++ b/jstests/core/dbadmin.js
@@ -12,22 +12,22 @@ assert( res.databases && res.databases.length > 0 , "listDatabases 1 " + tojson(
var now = new Date();
var x = db._adminCommand( "ismaster" );
-assert( x.ismaster , "ismaster failed: " + tojson( x ) )
-assert( x.localTime, "ismaster didn't include time: " + tojson(x))
+assert( x.ismaster , "ismaster failed: " + tojson( x ) );
+assert( x.localTime, "ismaster didn't include time: " + tojson(x));
-var localTimeSkew = x.localTime - now
+var localTimeSkew = x.localTime - now;
if ( localTimeSkew >= 50 ) {
- print( "Warning: localTimeSkew " + localTimeSkew + " > 50ms." )
+ print( "Warning: localTimeSkew " + localTimeSkew + " > 50ms." );
}
-assert.lt( localTimeSkew, 500, "isMaster.localTime" )
+assert.lt( localTimeSkew, 500, "isMaster.localTime" );
-var before = db.runCommand( "serverStatus" )
+var before = db.runCommand( "serverStatus" );
print(before.uptimeEstimate);
-sleep( 5000 )
+sleep( 5000 );
-var after = db.runCommand( "serverStatus" )
+var after = db.runCommand( "serverStatus" );
print(after.uptimeEstimate);
-assert.lt( 2 , after.uptimeEstimate , "up1" )
+assert.lt( 2 , after.uptimeEstimate , "up1" );
assert.gt( after.uptimeEstimate , before.uptimeEstimate , "up2" );
})();
diff --git a/jstests/core/dbcase.js b/jstests/core/dbcase.js
index 078abf07288..5663046443f 100644
--- a/jstests/core/dbcase.js
+++ b/jstests/core/dbcase.js
@@ -1,7 +1,7 @@
// Check db name duplication constraint SERVER-2111
-a = db.getSisterDB( "dbcasetest_dbnamea" )
-b = db.getSisterDB( "dbcasetest_dbnameA" )
+a = db.getSisterDB( "dbcasetest_dbnamea" );
+b = db.getSisterDB( "dbcasetest_dbnameA" );
a.dropDatabase();
b.dropDatabase();
diff --git a/jstests/core/dbcase2.js b/jstests/core/dbcase2.js
index 553db73147b..37c037001d8 100644
--- a/jstests/core/dbcase2.js
+++ b/jstests/core/dbcase2.js
@@ -1,7 +1,7 @@
// SERVER-2111 Check that an in memory db name will block creation of a db with a similar but differently cased name.
-var dbLowerCase = db.getSisterDB( "dbcase2test_dbnamea" )
-var dbUpperCase = db.getSisterDB( "dbcase2test_dbnameA" )
+var dbLowerCase = db.getSisterDB( "dbcase2test_dbnamea" );
+var dbUpperCase = db.getSisterDB( "dbcase2test_dbnameA" );
var resultLower = dbLowerCase.c.insert({});
assert.eq(1, resultLower.nInserted);
diff --git a/jstests/core/delx.js b/jstests/core/delx.js
index 06a48b2cd25..c4e3ca263d6 100644
--- a/jstests/core/delx.js
+++ b/jstests/core/delx.js
@@ -1,6 +1,6 @@
-a = db.getSisterDB("delxa" )
-b = db.getSisterDB("delxb" )
+a = db.getSisterDB("delxa" );
+b = db.getSisterDB("delxb" );
function setup( mydb ){
mydb.dropDatabase();
@@ -12,19 +12,19 @@ function setup( mydb ){
setup( a );
setup( b );
-assert.eq( 100 , a.foo.find().itcount() , "A1" )
-assert.eq( 100 , b.foo.find().itcount() , "A2" )
+assert.eq( 100 , a.foo.find().itcount() , "A1" );
+assert.eq( 100 , b.foo.find().itcount() , "A2" );
-x = a.foo.find().sort( { _id : 1 } ).batchSize( 60 )
-y = b.foo.find().sort( { _id : 1 } ).batchSize( 60 )
+x = a.foo.find().sort( { _id : 1 } ).batchSize( 60 );
+y = b.foo.find().sort( { _id : 1 } ).batchSize( 60 );
x.next();
y.next();
a.foo.remove( { _id : { $gt : 50 } } );
-assert.eq( 51 , a.foo.find().itcount() , "B1" )
-assert.eq( 100 , b.foo.find().itcount() , "B2" )
+assert.eq( 51 , a.foo.find().itcount() , "B1" );
+assert.eq( 100 , b.foo.find().itcount() , "B2" );
xCount = x.itcount();
assert( xCount == 59 || xCount == 99, "C1 : " + xCount ); // snapshot or not is ok
diff --git a/jstests/core/depth_limit.js b/jstests/core/depth_limit.js
index 7523a1fc9fe..3a8ef2460ca 100644
--- a/jstests/core/depth_limit.js
+++ b/jstests/core/depth_limit.js
@@ -3,11 +3,11 @@
function test() {
function assertTooBig(obj) {
// This used to crash rather than throwing an exception.
- assert.throws(function(){Object.bsonsize(obj)});
+ assert.throws(function(){Object.bsonsize(obj);});
}
function assertNotTooBig(obj) {
- assert.doesNotThrow(function(){Object.bsonsize(obj)});
+ assert.doesNotThrow(function(){Object.bsonsize(obj);});
}
function objWithDepth(depth) {
diff --git a/jstests/core/distinct1.js b/jstests/core/distinct1.js
index 2224d19bb4e..779f5a12ba1 100644
--- a/jstests/core/distinct1.js
+++ b/jstests/core/distinct1.js
@@ -4,11 +4,11 @@ t.drop();
assert.eq( 0 , t.distinct( "a" ).length , "test empty" );
-t.save( { a : 1 } )
-t.save( { a : 2 } )
-t.save( { a : 2 } )
-t.save( { a : 2 } )
-t.save( { a : 3 } )
+t.save( { a : 1 } );
+t.save( { a : 2 } );
+t.save( { a : 2 } );
+t.save( { a : 2 } );
+t.save( { a : 3 } );
res = t.distinct( "a" );
@@ -26,7 +26,7 @@ t.save( { a : { b : "c" } , c : 12 } );
res = t.distinct( "a.b" );
assert.eq( "a,b,c" , res.toString() , "B1" );
printjson(t._distinct( "a.b" ).stats);
-assert.eq( "COLLSCAN" , t._distinct( "a.b" ).stats.planSummary , "B2" )
+assert.eq( "COLLSCAN" , t._distinct( "a.b" ).stats.planSummary , "B2" );
t.drop();
diff --git a/jstests/core/distinct2.js b/jstests/core/distinct2.js
index 41ee78c5117..1517ec5ca3a 100644
--- a/jstests/core/distinct2.js
+++ b/jstests/core/distinct2.js
@@ -8,6 +8,6 @@ assert.eq( 0 , t.distinct('a.b').length , "A" );
t.drop();
t.save( { a : 1 } );
assert.eq( [1] , t.distinct( "a" ) , "B" );
-t.save( {} )
+t.save( {} );
assert.eq( [1] , t.distinct( "a" ) , "C" );
diff --git a/jstests/core/distinct_array1.js b/jstests/core/distinct_array1.js
index 2f289ad2e79..d59e4351db2 100644
--- a/jstests/core/distinct_array1.js
+++ b/jstests/core/distinct_array1.js
@@ -1,10 +1,10 @@
t = db.distinct_array1;
t.drop();
-t.save( { a : [1,2,3] } )
-t.save( { a : [2,3,4] } )
-t.save( { a : [3,4,5] } )
-t.save( { a : 9 } )
+t.save( { a : [1,2,3] } );
+t.save( { a : [2,3,4] } );
+t.save( { a : [3,4,5] } );
+t.save( { a : 9 } );
// Without index.
@@ -56,14 +56,14 @@ assert.eq( "d,e,f" , res.toString() , "B3" );
// With index.
t.ensureIndex( { "a.b" : 1 } );
res = t.distinct( "a.b" );
-res.sort()
+res.sort();
assert.eq( "a,b,c,d,e,f,z" , res.toString() , "B4" );
// _id as an document containing an array
-t.save( { _id : { a : [1,2,3] } } )
-t.save( { _id : { a : [2,3,4] } } )
-t.save( { _id : { a : [3,4,5] } } )
-t.save( { _id : { a : 9 } } )
+t.save( { _id : { a : [1,2,3] } } );
+t.save( { _id : { a : [2,3,4] } } );
+t.save( { _id : { a : [3,4,5] } } );
+t.save( { _id : { a : 9 } } );
// Without index.
res = t.distinct( "_id.a" ).sort();
diff --git a/jstests/core/distinct_index1.js b/jstests/core/distinct_index1.js
index 6149400d566..959e46ebdaf 100644
--- a/jstests/core/distinct_index1.js
+++ b/jstests/core/distinct_index1.js
@@ -1,5 +1,5 @@
-t = db.distinct_index1
+t = db.distinct_index1;
t.drop();
function r( x ){
@@ -7,7 +7,7 @@ function r( x ){
}
function d( k , q ){
- return t.runCommand( "distinct" , { key : k , query : q || {} } )
+ return t.runCommand( "distinct" , { key : k , query : q || {} } );
}
for ( i=0; i<1000; i++ ){
@@ -18,44 +18,44 @@ for ( i=0; i<1000; i++ ){
x = d( "a" );
// Collection scan looks at all 1000 documents and gets 1000
// distinct values. Looks at 0 index keys.
-assert.eq( 1000 , x.stats.n , "AA1" )
-assert.eq( 0 , x.stats.nscanned , "AA2" )
-assert.eq( 1000 , x.stats.nscannedObjects , "AA3" )
+assert.eq( 1000 , x.stats.n , "AA1" );
+assert.eq( 0 , x.stats.nscanned , "AA2" );
+assert.eq( 1000 , x.stats.nscannedObjects , "AA3" );
x = d( "a" , { a : { $gt : 5 } } );
// Collection scan looks at all 1000 documents and gets 398
// distinct values which match the query. Looks at 0 index keys.
-assert.eq( 398 , x.stats.n , "AB1" )
-assert.eq( 0 , x.stats.nscanned , "AB2" )
-assert.eq( 1000 , x.stats.nscannedObjects , "AB3" )
+assert.eq( 398 , x.stats.n , "AB1" );
+assert.eq( 0 , x.stats.nscanned , "AB2" );
+assert.eq( 1000 , x.stats.nscannedObjects , "AB3" );
x = d( "b" , { a : { $gt : 5 } } );
// Collection scan looks at all 1000 documents and gets 398
// distinct values which match the query. Looks at 0 index keys.
-assert.eq( 398 , x.stats.n , "AC1" )
-assert.eq( 0 , x.stats.nscanned , "AC2" )
-assert.eq( 1000 , x.stats.nscannedObjects , "AC3" )
+assert.eq( 398 , x.stats.n , "AC1" );
+assert.eq( 0 , x.stats.nscanned , "AC2" );
+assert.eq( 1000 , x.stats.nscannedObjects , "AC3" );
-t.ensureIndex( { a : 1 } )
+t.ensureIndex( { a : 1 } );
x = d( "a" );
// There are only 10 values. We use the fast distinct hack and only examine each value once.
-assert.eq( 10 , x.stats.n , "BA1" )
-assert.eq( 10 , x.stats.nscanned , "BA2" )
+assert.eq( 10 , x.stats.n , "BA1" );
+assert.eq( 10 , x.stats.nscanned , "BA2" );
x = d( "a" , { a : { $gt : 5 } } );
// Only 4 values of a are >= 5 and we use the fast distinct hack.
-assert.eq(4, x.stats.n , "BB1" )
-assert.eq(4, x.stats.nscanned , "BB2" )
-assert.eq(0, x.stats.nscannedObjects , "BB3" )
+assert.eq(4, x.stats.n , "BB1" );
+assert.eq(4, x.stats.nscanned , "BB2" );
+assert.eq(0, x.stats.nscannedObjects , "BB3" );
x = d( "b" , { a : { $gt : 5 } } );
// We can't use the fast distinct hack here because we're distinct-ing over 'b'.
-assert.eq( 398 , x.stats.n , "BC1" )
-assert.eq( 398 , x.stats.nscanned , "BC2" )
-assert.eq( 398 , x.stats.nscannedObjects , "BC3" )
+assert.eq( 398 , x.stats.n , "BC1" );
+assert.eq( 398 , x.stats.nscanned , "BC2" );
+assert.eq( 398 , x.stats.nscannedObjects , "BC3" );
// Check proper nscannedObjects count when using a query optimizer cursor.
t.dropIndexes();
@@ -65,7 +65,7 @@ printjson(x);
// 171 is the # of results we happen to scan when we don't use a distinct
// hack. When we use the distinct hack we scan 16, currently.
assert.lte(x.stats.n, 171);
-assert.eq(171, x.stats.nscannedObjects , "BD3" )
+assert.eq(171, x.stats.nscannedObjects , "BD3" );
// Should use an index scan over the hashed index.
t.dropIndexes();
diff --git a/jstests/core/distinct_index2.js b/jstests/core/distinct_index2.js
index 67d28b8b95e..8899a048714 100644
--- a/jstests/core/distinct_index2.js
+++ b/jstests/core/distinct_index2.js
@@ -1,8 +1,8 @@
t = db.distinct_index2;
t.drop();
-t.ensureIndex( { a : 1 , b : 1 } )
-t.ensureIndex( { c : 1 } )
+t.ensureIndex( { a : 1 , b : 1 } );
+t.ensureIndex( { c : 1 } );
// Uniformly distributed dataset.
// If we use a randomly generated dataset, we might not
@@ -15,25 +15,25 @@ for ( var a=0; a<10; a++ ) {
}
}
-correct = []
+correct = [];
for ( i=0; i<10; i++ )
- correct.push( i )
+ correct.push( i );
function check( field ){
- res = t.distinct( field )
- res = res.sort()
+ res = t.distinct( field );
+ res = res.sort();
assert.eq( correct , res , "check: " + field );
if ( field != "a" ){
- res = t.distinct( field , { a : 1 } )
- res = res.sort()
+ res = t.distinct( field , { a : 1 } );
+ res = res.sort();
assert.eq( correct , res , "check 2: " + field );
}
}
-check( "a" )
-check( "b" )
-check( "c" )
+check( "a" );
+check( "b" );
+check( "c" );
// hashed index should produce same results.
t.dropIndexes();
diff --git a/jstests/core/distinct_speed1.js b/jstests/core/distinct_speed1.js
index dff1094f994..c511de34087 100644
--- a/jstests/core/distinct_speed1.js
+++ b/jstests/core/distinct_speed1.js
@@ -23,4 +23,4 @@ for ( i=0; i<3; i++ ){
t.ensureIndex( { x : 1 } );
-t.distinct( "x" , { x : 5 } )
+t.distinct( "x" , { x : 5 } );
diff --git a/jstests/core/drop3.js b/jstests/core/drop3.js
index d97b40989b8..65fe072cf97 100644
--- a/jstests/core/drop3.js
+++ b/jstests/core/drop3.js
@@ -20,6 +20,6 @@ assert.eq( subcursor.objsLeftInBatch(), 1 );
t.drop(); // should invalidate cursor, but not subcursor
-assert.throws( function(){ cursor.itcount() } ); // throws "cursor doesn't exist on server" error on getMore
+assert.throws( function(){ cursor.itcount(); } ); // throws "cursor doesn't exist on server" error on getMore
assert.eq( subcursor.itcount(), 9 ); //one already seen
diff --git a/jstests/core/drop_index.js b/jstests/core/drop_index.js
index 8e2278d00c5..938ac0d2547 100644
--- a/jstests/core/drop_index.js
+++ b/jstests/core/drop_index.js
@@ -12,7 +12,7 @@ assert.eq( 3 , t.getIndexes().length , "A2" );
x = db._dbCommand( { dropIndexes: t.getName() , index : t._genIndexName( { a : 1 } ) } );
assert.eq( 2 , t.getIndexes().length , "B1 " + tojson(x) );
-x = db._dbCommand( { dropIndexes: t.getName() , index : { b : 1 } } )
+x = db._dbCommand( { dropIndexes: t.getName() , index : { b : 1 } } );
assert.eq( 1 , t.getIndexes().length , "B2" );
// ensure you can recreate indexes, even if you don't use dropIndex method
diff --git a/jstests/core/elemMatchProjection.js b/jstests/core/elemMatchProjection.js
index 73088fab699..96fb11cc987 100644
--- a/jstests/core/elemMatchProjection.js
+++ b/jstests/core/elemMatchProjection.js
@@ -81,10 +81,10 @@ assert.throws( function() {
}, [], "throw on invalid projection (field mismatch)" );
assert.throws( function() {
- t.find( { group:3, 'x.a':2 }, { 'y.$':1 } ).sort( { x:1 } ).toArray()
+ t.find( { group:3, 'x.a':2 }, { 'y.$':1 } ).sort( { x:1 } ).toArray();
}, [], "throw on invalid sorted projection (field mismatch)" );
-assert.throws( function() {x
+assert.throws( function() {x;
t.find( { group:3, 'x.a':2 }, { 'x.$':1, group:0 } ).sort( { x:1 } ).toArray();
}, [], "throw on invalid projection combination (include and exclude)" );
@@ -93,7 +93,7 @@ assert.throws( function() {
}, [], "throw on multiple projections" );
assert.throws( function() {
- t.find( { group:3}, { 'g.$':1 } ).toArray()
+ t.find( { group:3}, { 'g.$':1 } ).toArray();
}, [], "throw on invalid projection (non-array field)" );
assert.eq( { aa:1, dd:5 },
@@ -226,13 +226,13 @@ if (false) {
// Batch/getMore tests
//
// test positional operator across multiple batches
-a = t.find( { group:3, 'x.b':2 }, { 'x.$':1 } ).batchSize(1)
+a = t.find( { group:3, 'x.b':2 }, { 'x.$':1 } ).batchSize(1);
while ( a.hasNext() ) {
assert.eq( 2, a.next().x[0].b, "positional getMore test");
}
// test $elemMatch operator across multiple batches
-a = t.find( { group:3 }, { x:{$elemMatch:{a:1}} } ).batchSize(1)
+a = t.find( { group:3 }, { x:{$elemMatch:{a:1}} } ).batchSize(1);
while ( a.hasNext() ) {
assert.eq( 1, a.next().x[0].a, "positional getMore test");
}
diff --git a/jstests/core/error2.js b/jstests/core/error2.js
index 8c27d6250e1..2a6a10170a1 100644
--- a/jstests/core/error2.js
+++ b/jstests/core/error2.js
@@ -8,7 +8,7 @@ f.save( {a:1} );
assert.throws(
function(){
- c = f.find({$where : function(){ return a() }});
+ c = f.find({$where : function(){ return a(); }});
c.next();
}
);
diff --git a/jstests/core/error5.js b/jstests/core/error5.js
index 5884d20d8c1..4a58f0dcf7a 100644
--- a/jstests/core/error5.js
+++ b/jstests/core/error5.js
@@ -1,8 +1,8 @@
-t = db.error5
+t = db.error5;
t.drop();
-assert.throws( function(){ t.save( 4 ); printjson( t.findOne() ) } , null , "A" );
-t.save( { a : 1 } )
+assert.throws( function(){ t.save( 4 ); printjson( t.findOne() ); } , null , "A" );
+t.save( { a : 1 } );
assert.eq( 1 , t.count() , "B" );
diff --git a/jstests/core/eval1.js b/jstests/core/eval1.js
index 4a5ca75f09b..1fdcec66152 100644
--- a/jstests/core/eval1.js
+++ b/jstests/core/eval1.js
@@ -7,7 +7,7 @@ t.save( { _id : 2 , name : "sara" } );
f = function(id){
return db["eval1"].findOne( { _id : id } ).name;
-}
+};
assert.eq( "eliot" , f( 1 ) , "A" );
diff --git a/jstests/core/eval7.js b/jstests/core/eval7.js
index 45e06af276c..3d706a2eaa7 100644
--- a/jstests/core/eval7.js
+++ b/jstests/core/eval7.js
@@ -1,3 +1,3 @@
-assert.eq( 6 , db.eval( "5 + 1" ) , "A" )
-assert.throws( function(z){ db.eval( "5 + function x; + 1" )} );
+assert.eq( 6 , db.eval( "5 + 1" ) , "A" );
+assert.throws( function(z){ db.eval( "5 + function x; + 1" );} );
diff --git a/jstests/core/eval8.js b/jstests/core/eval8.js
index 072a890e80a..e2ec3db31a8 100644
--- a/jstests/core/eval8.js
+++ b/jstests/core/eval8.js
@@ -9,7 +9,7 @@ x = t.findOne();
assert( x.a && x.b , "A" );
delete x.b;
-assert( x.a && ! x.b , "B" )
+assert( x.a && ! x.b , "B" );
x.b = 3;
assert( x.a && x.b , "C" );
assert.eq( 3 , x.b , "D" );
diff --git a/jstests/core/eval9.js b/jstests/core/eval9.js
index 9c6642901e4..a6d8560416e 100644
--- a/jstests/core/eval9.js
+++ b/jstests/core/eval9.js
@@ -1,5 +1,5 @@
-a = [ 1 , "asd" , null , [ 2 , 3 ] , new Date() , { x : 1 } ]
+a = [ 1 , "asd" , null , [ 2 , 3 ] , new Date() , { x : 1 } ];
for ( var i=0; i<a.length; i++ ){
var ret = db.eval( "function( a , i ){ return a[i]; }" , a , i );
diff --git a/jstests/core/eval_nolock.js b/jstests/core/eval_nolock.js
index 2ab96a302a5..4701df9b7f7 100644
--- a/jstests/core/eval_nolock.js
+++ b/jstests/core/eval_nolock.js
@@ -1,5 +1,5 @@
-t = db.eval_nolock
+t = db.eval_nolock;
t.drop();
for ( i=0; i<10; i++ )
@@ -12,5 +12,5 @@ res = db.runCommand( { eval :
}
, nolock : true } );
-assert.eq( 11 , res.retval , "A" )
+assert.eq( 11 , res.retval , "A" );
diff --git a/jstests/core/evala.js b/jstests/core/evala.js
index ed72582fbb6..88d479127c0 100644
--- a/jstests/core/evala.js
+++ b/jstests/core/evala.js
@@ -1,8 +1,8 @@
t = db.evala;
-t.drop()
+t.drop();
-t.save( { x : 5 } )
+t.save( { x : 5 } );
assert.eq( 5 , db.eval( "function(){ return db.evala.findOne().x; }" ) , "A" );
assert.eq( 5 , db.eval( "/* abc */function(){ return db.evala.findOne().x; }" ) , "B" );
diff --git a/jstests/core/evalc.js b/jstests/core/evalc.js
index c5c6327cd6d..36ea04037d0 100644
--- a/jstests/core/evalc.js
+++ b/jstests/core/evalc.js
@@ -1,8 +1,8 @@
t = db.jstests_evalc;
t.drop();
-t2 = db.evalc_done
-t2.drop()
+t2 = db.evalc_done;
+t2.drop();
for( i = 0; i < 10; ++i ) {
t.save( {i:i} );
@@ -10,16 +10,16 @@ for( i = 0; i < 10; ++i ) {
// SERVER-1610
-assert.eq( 0 , t2.count() , "X1" )
+assert.eq( 0 , t2.count() , "X1" );
-s = startParallelShell( "print( 'starting forked:' + Date() ); for ( i=0; i<10*1000; i++ ){ db.currentOp(); } print( 'ending forked:' + Date() ); db.evalc_done.insert( { x : 1 } ); " )
+s = startParallelShell( "print( 'starting forked:' + Date() ); for ( i=0; i<10*1000; i++ ){ db.currentOp(); } print( 'ending forked:' + Date() ); db.evalc_done.insert( { x : 1 } ); " );
-print( "starting eval: " + Date() )
+print( "starting eval: " + Date() );
assert.soon(function() {
db.eval( "db.jstests_evalc.count( {i:10} );" );
return t2.count() > 0;
}, 'parallel shell failed to update ' + t2.getFullName(), 120000, 10);
-print( "end eval: " + Date() )
+print( "end eval: " + Date() );
s();
diff --git a/jstests/core/evald.js b/jstests/core/evald.js
index 02b7beb3e43..7e516e9f7d6 100644
--- a/jstests/core/evald.js
+++ b/jstests/core/evald.js
@@ -37,7 +37,7 @@ function doIt( ev, wait, where ) {
}
o = null;
- assert.soon( function() { o = op( ev, where ); return o != -1 } );
+ assert.soon( function() { o = op( ev, where ); return o != -1; } );
if ( wait ) {
sleep( 2000 );
diff --git a/jstests/core/evale.js b/jstests/core/evale.js
index af5a303f167..a0f81942479 100644
--- a/jstests/core/evale.js
+++ b/jstests/core/evale.js
@@ -1,5 +1,5 @@
t = db.jstests_evale;
t.drop();
-db.eval( function() { return db.jstests_evale.count( { $where:function() { return true; } } ) } );
+db.eval( function() { return db.jstests_evale.count( { $where:function() { return true; } } ); } );
db.eval( "db.jstests_evale.count( { $where:function() { return true; } } )" ); \ No newline at end of file
diff --git a/jstests/core/exists.js b/jstests/core/exists.js
index 3f1e904e52f..e41a7cfde04 100644
--- a/jstests/core/exists.js
+++ b/jstests/core/exists.js
@@ -32,12 +32,12 @@ function dotest( n ){
assert.eq( 4, t.count( {'a.b.c.d': {$exists:false}} ) , n );
}
-dotest( "before index" )
-t.ensureIndex( { "a" : 1 } )
-t.ensureIndex( { "a.b" : 1 } )
-t.ensureIndex( { "a.b.c" : 1 } )
-t.ensureIndex( { "a.b.c.d" : 1 } )
-dotest( "after index" )
+dotest( "before index" );
+t.ensureIndex( { "a" : 1 } );
+t.ensureIndex( { "a.b" : 1 } );
+t.ensureIndex( { "a.b.c" : 1 } );
+t.ensureIndex( { "a.b.c.d" : 1 } );
+dotest( "after index" );
assert.eq( 1, t.find( {a: {$exists:false}} ).hint( {a:1} ).itcount() );
t.drop();
diff --git a/jstests/core/exists2.js b/jstests/core/exists2.js
index e925c168f50..90ff25e0feb 100644
--- a/jstests/core/exists2.js
+++ b/jstests/core/exists2.js
@@ -2,15 +2,15 @@
t = db.exists2;
t.drop();
-t.save( { a : 1 , b : 1 } )
-t.save( { a : 1 , b : 1 , c : 1 } )
+t.save( { a : 1 , b : 1 } );
+t.save( { a : 1 , b : 1 , c : 1 } );
assert.eq( 2 , t.find().itcount() , "A1" );
assert.eq( 2 , t.find( { a : 1 , b : 1 } ).itcount() , "A2" );
assert.eq( 1 , t.find( { a : 1 , b : 1 , c : { "$exists" : true } } ).itcount() , "A3" );
assert.eq( 1 , t.find( { a : 1 , b : 1 , c : { "$exists" : false } } ).itcount() , "A4" );
-t.ensureIndex( { a : 1 , b : 1 , c : 1 } )
+t.ensureIndex( { a : 1 , b : 1 , c : 1 } );
assert.eq( 1 , t.find( { a : 1 , b : 1 , c : { "$exists" : true } } ).itcount() , "B1" );
assert.eq( 1 , t.find( { a : 1 , b : 1 , c : { "$exists" : false } } ).itcount() , "B2" );
diff --git a/jstests/core/exists3.js b/jstests/core/exists3.js
index 53a69d6c3bb..c61f022939c 100644
--- a/jstests/core/exists3.js
+++ b/jstests/core/exists3.js
@@ -11,7 +11,7 @@ assert.eq( 1, t.find({c: {$exists: false}}).itcount() );
assert.eq( 1, t.find({c: {$exists: false}}).sort({c: -1}).itcount() );
// now we have an index on the sort key
-t.ensureIndex({c: -1})
+t.ensureIndex({c: -1});
assert.eq( 1, t.find({c: {$exists: false}}).sort({c: -1}).itcount() );
assert.eq( 1, t.find({c: {$exists: false}}).itcount() );
diff --git a/jstests/core/existsa.js b/jstests/core/existsa.js
index d1fecc2461e..0d2472ca328 100644
--- a/jstests/core/existsa.js
+++ b/jstests/core/existsa.js
@@ -37,7 +37,7 @@ function assertExists( query, expectedExists ) {
assert.eq( expectedExists, t.count( query ) );
// An $exists:true predicate generates no index filters. Add another predicate on the index key
// to trigger use of the index.
- andClause = {}
+ andClause = {};
andClause[ indexKeyField ] = { $ne:null };
Object.extend( query, { $and:[ andClause ] } );
assert.eq( expectedExists, t.count( query ) );
@@ -49,7 +49,7 @@ function assertExistsUnindexed( query, expectedExists ) {
expectedExists = expectedExists || 2;
assert.eq( expectedExists, t.count( query ) );
// Even with another predicate on the index key, the sparse index is disallowed.
- andClause = {}
+ andClause = {};
andClause[ indexKeyField ] = { $ne:null };
Object.extend( query, { $and:[ andClause ] } );
assert.eq( expectedExists, t.count( query ) );
diff --git a/jstests/core/explain3.js b/jstests/core/explain3.js
index c205e57252c..738f8570a0d 100644
--- a/jstests/core/explain3.js
+++ b/jstests/core/explain3.js
@@ -11,7 +11,7 @@ for( var i = 0; i < 10000; ++i ) {
s = startParallelShell( "sleep( 20 ); db.jstests_explain3.dropIndex( {i:1} );" );
try {
- t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain()
+ t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain();
} catch (e) {
print( "got exception" );
printjson( e );
diff --git a/jstests/core/explain_batch_size.js b/jstests/core/explain_batch_size.js
index 7528098107b..8331e158ff8 100644
--- a/jstests/core/explain_batch_size.js
+++ b/jstests/core/explain_batch_size.js
@@ -7,7 +7,7 @@
t = db.explain_batch_size;
t.drop();
-var n = 3
+var n = 3;
for (i=0; i<n; i++) {
t.save( { x : i } );
}
diff --git a/jstests/core/filemd5.js b/jstests/core/filemd5.js
index 41d03a1bb30..62f69bd657f 100644
--- a/jstests/core/filemd5.js
+++ b/jstests/core/filemd5.js
@@ -1,11 +1,11 @@
db.fs.chunks.drop();
-db.fs.chunks.insert({files_id:1,n:0,data:new BinData(0,"test")})
+db.fs.chunks.insert({files_id:1,n:0,data:new BinData(0,"test")});
x = db.runCommand({"filemd5":1,"root":"fs"});
-assert( ! x.ok , tojson(x) )
+assert( ! x.ok , tojson(x) );
-db.fs.chunks.ensureIndex({files_id:1,n:1})
+db.fs.chunks.ensureIndex({files_id:1,n:1});
x = db.runCommand({"filemd5":1,"root":"fs"});
-assert( x.ok , tojson(x) )
+assert( x.ok , tojson(x) );
diff --git a/jstests/core/find1.js b/jstests/core/find1.js
index 1ad998062a4..e6d68540bdf 100644
--- a/jstests/core/find1.js
+++ b/jstests/core/find1.js
@@ -14,7 +14,7 @@ print( "lookAtDocumentMetrics: " + lookAtDocumentMetrics );
if ( lookAtDocumentMetrics ) {
// ignore mongos
- nscannedStart = db.serverStatus().metrics.queryExecutor.scanned
+ nscannedStart = db.serverStatus().metrics.queryExecutor.scanned;
}
@@ -48,6 +48,6 @@ assert(t.validate().valid,"not valid");
if ( lookAtDocumentMetrics ) {
// ignore mongos
- nscannedEnd = db.serverStatus().metrics.queryExecutor.scanned
+ nscannedEnd = db.serverStatus().metrics.queryExecutor.scanned;
assert.lte( nscannedStart + 16, nscannedEnd );
}
diff --git a/jstests/core/find4.js b/jstests/core/find4.js
index 17639d3a684..eb9ff60e33c 100644
--- a/jstests/core/find4.js
+++ b/jstests/core/find4.js
@@ -22,5 +22,5 @@ assert( ! o.a , "I" );
t.drop();
t.save( { a : 1 , b : 1 } );
t.save( { a : 2 , b : 2 } );
-assert.eq( "1-1,2-2" , t.find().map( function(z){ return z.a + "-" + z.b } ).toString() );
-assert.eq( "1-undefined,2-undefined" , t.find( {} , { a : 1 }).map( function(z){ return z.a + "-" + z.b } ).toString() );
+assert.eq( "1-1,2-2" , t.find().map( function(z){ return z.a + "-" + z.b; } ).toString() );
+assert.eq( "1-undefined,2-undefined" , t.find( {} , { a : 1 }).map( function(z){ return z.a + "-" + z.b; } ).toString() );
diff --git a/jstests/core/find5.js b/jstests/core/find5.js
index b4a2c0f8865..ab648906122 100644
--- a/jstests/core/find5.js
+++ b/jstests/core/find5.js
@@ -46,6 +46,6 @@ assert( !o.b.e , "E 3" );
assert( ! t.find( {} , { "b.c" : 1 } ).toArray()[0].b.d , "F" );
t.drop();
-t.save( { a : { b : { c : 1 } } } )
+t.save( { a : { b : { c : 1 } } } );
assert.eq( 1 , t.find( {} , { "a.b.c" : 1 } )[0].a.b.c , "G" );
diff --git a/jstests/core/find6.js b/jstests/core/find6.js
index c4efd3b88d3..0739c38aa9f 100644
--- a/jstests/core/find6.js
+++ b/jstests/core/find6.js
@@ -2,8 +2,8 @@
t = db.find6;
t.drop();
-t.save( { a : 1 } )
-t.save( { a : 1 , b : 1 } )
+t.save( { a : 1 } );
+t.save( { a : 1 , b : 1 } );
assert.eq( 2 , t.find().count() , "A" );
assert.eq( 1 , t.find( { b : null } ).count() , "B" );
diff --git a/jstests/core/find_and_modify3.js b/jstests/core/find_and_modify3.js
index 4214dfbcd0a..5dd24726d30 100644
--- a/jstests/core/find_and_modify3.js
+++ b/jstests/core/find_and_modify3.js
@@ -5,8 +5,8 @@ t.insert({_id:0, other:0, comments:[{i:0, j:0}, {i:1, j:1}]});
t.insert({_id:1, other:1, comments:[{i:0, j:0}, {i:1, j:1}]}); // this is the only one that gets modded
t.insert({_id:2, other:2, comments:[{i:0, j:0}, {i:1, j:1}]});
-orig0 = t.findOne({_id:0})
-orig2 = t.findOne({_id:2})
+orig0 = t.findOne({_id:0});
+orig2 = t.findOne({_id:2});
out = t.findAndModify({query: {_id:1, 'comments.i':0}, update: {$set: {'comments.$.j':2}}, 'new': true, sort:{other:1}});
assert.eq(out.comments[0], {i:0, j:2});
diff --git a/jstests/core/find_and_modify_concurrent_update.js b/jstests/core/find_and_modify_concurrent_update.js
index cd7984ed75c..2dd1e182008 100644
--- a/jstests/core/find_and_modify_concurrent_update.js
+++ b/jstests/core/find_and_modify_concurrent_update.js
@@ -1,7 +1,7 @@
// Ensures that find and modify will not apply an update to a document which, due to a concurrent
// modification, no longer matches the query predicate.
(function() {
- "use strict"
+ "use strict";
// Repeat the test a few times, as the timing of the yield means it won't fail consistently.
for (var i = 0; i < 3; i++) {
diff --git a/jstests/core/find_and_modify_empty_coll.js b/jstests/core/find_and_modify_empty_coll.js
index 0f5711b25ce..9c231fb2d1f 100644
--- a/jstests/core/find_and_modify_empty_coll.js
+++ b/jstests/core/find_and_modify_empty_coll.js
@@ -12,7 +12,7 @@
{query: {_id: 0}, update: {$inc: {i: 1}}, upsert: true, new: true});
assert.eq(upserted, {_id: 0, i: 1});
- coll.drop()
+ coll.drop();
assert.eq(null, coll.findAndModify({remove: true, fields: {z: 1}}));
assert.eq(null, coll.findAndModify({update: {$inc: {i: 1}}, fields: {z: 1}}));
diff --git a/jstests/core/find_and_modify_server6226.js b/jstests/core/find_and_modify_server6226.js
index a44cb59cb05..21d1bdad6f8 100644
--- a/jstests/core/find_and_modify_server6226.js
+++ b/jstests/core/find_and_modify_server6226.js
@@ -2,6 +2,6 @@
t = db.find_and_modify_server6226;
t.drop();
-ret = t.findAndModify( { query : { _id : 1 } , update : { "$inc" : { i : 1 } } , upsert : true } )
-assert.isnull( ret )
+ret = t.findAndModify( { query : { _id : 1 } , update : { "$inc" : { i : 1 } } , upsert : true } );
+assert.isnull( ret );
diff --git a/jstests/core/find_and_modify_server6254.js b/jstests/core/find_and_modify_server6254.js
index 7c7c340b7ed..9850a4f3fb9 100644
--- a/jstests/core/find_and_modify_server6254.js
+++ b/jstests/core/find_and_modify_server6254.js
@@ -2,9 +2,9 @@
t = db.find_and_modify_server6254;
t.drop();
-t.insert( { x : 1 } )
-ret = t.findAndModify( { query : { x : 1 } , update : { $set : { x : 2 } } , new : true } )
-assert.eq( 2 , ret.x , tojson( ret ) )
+t.insert( { x : 1 } );
+ret = t.findAndModify( { query : { x : 1 } , update : { $set : { x : 2 } } , new : true } );
+assert.eq( 2 , ret.x , tojson( ret ) );
-assert.eq( 1 , t.count() )
+assert.eq( 1 , t.count() );
diff --git a/jstests/core/find_and_modify_server6582.js b/jstests/core/find_and_modify_server6582.js
index 88ce5a7c4f4..a48cc962fea 100644
--- a/jstests/core/find_and_modify_server6582.js
+++ b/jstests/core/find_and_modify_server6582.js
@@ -2,17 +2,17 @@
t = db.find_and_modify_server6582;
t.drop();
-x = t.runCommand( "findAndModify" , {query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true})
-le = x.lastErrorObject
-assert.eq( le.updatedExisting, false )
-assert.eq( le.n, 1 )
-assert.eq( le.upserted, x.value._id )
+x = t.runCommand( "findAndModify" , {query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true});
+le = x.lastErrorObject;
+assert.eq( le.updatedExisting, false );
+assert.eq( le.n, 1 );
+assert.eq( le.upserted, x.value._id );
t.drop();
-t.insert( { f : 1 } )
-x = t.runCommand( "findAndModify" , {query:{f:1}, remove : true } )
-le = x.lastErrorObject
-assert.eq( le.n, 1 )
+t.insert( { f : 1 } );
+x = t.runCommand( "findAndModify" , {query:{f:1}, remove : true } );
+le = x.lastErrorObject;
+assert.eq( le.n, 1 );
diff --git a/jstests/core/find_and_modify_server6588.js b/jstests/core/find_and_modify_server6588.js
index a21855f5c38..68d7f0739dc 100644
--- a/jstests/core/find_and_modify_server6588.js
+++ b/jstests/core/find_and_modify_server6588.js
@@ -1,22 +1,22 @@
t = db.find_and_modify_sever6588;
-initial = { _id : 1 , a : [ { b : 1 } ] , z : 1 }
-up = { "$set" : { "a.$.b" : 2 } }
-q = { _id : 1 , "a.b" : 1 }
-correct = { _id : 1 , a : [ { b : 2 } ] , z : 1 }
+initial = { _id : 1 , a : [ { b : 1 } ] , z : 1 };
+up = { "$set" : { "a.$.b" : 2 } };
+q = { _id : 1 , "a.b" : 1 };
+correct = { _id : 1 , a : [ { b : 2 } ] , z : 1 };
t.drop();
-t.insert( initial )
-t.update( q , up )
-assert.eq( correct , t.findOne() )
+t.insert( initial );
+t.update( q , up );
+assert.eq( correct , t.findOne() );
-t.drop()
-t.insert( initial )
-x = t.findAndModify( { query : q , update : up } )
-assert.eq( correct , t.findOne() )
+t.drop();
+t.insert( initial );
+x = t.findAndModify( { query : q , update : up } );
+assert.eq( correct , t.findOne() );
-t.drop()
-t.insert( initial )
-x = t.findAndModify( { query : { z : 1 , "a.b" : 1 } , update : up } )
-assert.eq( correct , t.findOne() )
+t.drop();
+t.insert( initial );
+x = t.findAndModify( { query : { z : 1 , "a.b" : 1 } , update : up } );
+assert.eq( correct , t.findOne() );
diff --git a/jstests/core/find_and_modify_server6659.js b/jstests/core/find_and_modify_server6659.js
index 7a0419cc72b..f5f89b051e6 100644
--- a/jstests/core/find_and_modify_server6659.js
+++ b/jstests/core/find_and_modify_server6659.js
@@ -2,6 +2,6 @@
t = db.find_and_modify_server6659;
t.drop();
-x = t.findAndModify({query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true})
+x = t.findAndModify({query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true});
assert.eq( 2, x.f );
assert.eq( 2, t.findOne().f );
diff --git a/jstests/core/find_and_modify_server7660.js b/jstests/core/find_and_modify_server7660.js
index cae50d17dcc..4828dff4e49 100644
--- a/jstests/core/find_and_modify_server7660.js
+++ b/jstests/core/find_and_modify_server7660.js
@@ -13,6 +13,6 @@ a = t.findAndModify({
b = t.findOne();
assert.eq( a, b );
assert.eq( "bar", a.foo );
-assert.eq( "john", a.bob )
+assert.eq( "john", a.bob );
diff --git a/jstests/core/find_and_modify_where.js b/jstests/core/find_and_modify_where.js
index 2092dc5566f..fe13a6894fd 100644
--- a/jstests/core/find_and_modify_where.js
+++ b/jstests/core/find_and_modify_where.js
@@ -4,7 +4,7 @@ t.drop();
t.insert( { _id : 1 , x : 1 } );
-res = t.findAndModify( { query : { $where : "return this.x == 1" } , update : { $set : { y : 1 } } } )
+res = t.findAndModify( { query : { $where : "return this.x == 1" } , update : { $set : { y : 1 } } } );
-assert.eq( 1 , t.findOne().y )
+assert.eq( 1 , t.findOne().y );
diff --git a/jstests/core/fm1.js b/jstests/core/fm1.js
index bc60a3d8911..de1df03edcb 100644
--- a/jstests/core/fm1.js
+++ b/jstests/core/fm1.js
@@ -2,7 +2,7 @@
t = db.fm1;
t.drop();
-t.insert({foo:{bar:1}})
+t.insert({foo:{bar:1}});
t.find({},{foo:1}).toArray();
t.find({},{'foo.bar':1}).toArray();
t.find({},{'baz':1}).toArray();
diff --git a/jstests/core/fm2.js b/jstests/core/fm2.js
index 00ccdf4afee..93284c0c611 100644
--- a/jstests/core/fm2.js
+++ b/jstests/core/fm2.js
@@ -1,9 +1,9 @@
-t = db.fm2
+t = db.fm2;
t.drop();
t.insert( { "one" : { "two" : {"three":"four"} } } );
-x = t.find({},{"one.two":1})[0]
+x = t.find({},{"one.two":1})[0];
assert.eq( 1 , Object.keySet( x.one ).length , "ks l 1" );
diff --git a/jstests/core/fm3.js b/jstests/core/fm3.js
index 8ccde6d5ab3..ebe79f16dc4 100644
--- a/jstests/core/fm3.js
+++ b/jstests/core/fm3.js
@@ -1,4 +1,4 @@
-t = db.fm3
+t = db.fm3;
t.drop();
t.insert( {a:[{c:{e:1, f:1}}, {d:2}, 'z'], b:1} );
diff --git a/jstests/core/fm4.js b/jstests/core/fm4.js
index 1ce947ad5e7..c90041cf485 100644
--- a/jstests/core/fm4.js
+++ b/jstests/core/fm4.js
@@ -1,16 +1,16 @@
-t = db.fm4
+t = db.fm4;
t.drop();
t.insert({_id:1, a:1, b:1});
-assert.eq( t.findOne({}, {_id:1}), {_id:1}, 1)
-assert.eq( t.findOne({}, {_id:0}), {a:1, b:1}, 2)
+assert.eq( t.findOne({}, {_id:1}), {_id:1}, 1);
+assert.eq( t.findOne({}, {_id:0}), {a:1, b:1}, 2);
-assert.eq( t.findOne({}, {_id:1, a:1}), {_id:1, a:1}, 3)
-assert.eq( t.findOne({}, {_id:0, a:1}), {a:1}, 4)
+assert.eq( t.findOne({}, {_id:1, a:1}), {_id:1, a:1}, 3);
+assert.eq( t.findOne({}, {_id:0, a:1}), {a:1}, 4);
-assert.eq( t.findOne({}, {_id:0, a:0}), {b:1}, 6)
-assert.eq( t.findOne({}, { a:0}), {_id:1, b:1}, 5)
+assert.eq( t.findOne({}, {_id:0, a:0}), {b:1}, 6);
+assert.eq( t.findOne({}, { a:0}), {_id:1, b:1}, 5);
// not sure if we want to suport this since it is the same as above
//assert.eq( t.findOne({}, {_id:1, a:0}), {_id:1, b:1}, 5)
diff --git a/jstests/core/fts1.js b/jstests/core/fts1.js
index 367cdf96262..5bdaa926b45 100644
--- a/jstests/core/fts1.js
+++ b/jstests/core/fts1.js
@@ -16,5 +16,5 @@ assert.eq( [1,2,3,4] , queryIDS( t , "c az" ) , "A1" );
assert.eq( [4] , queryIDS( t , "d" ) , "A2" );
idx = t.getIndexes()[1];
-assert( idx.v >= 1, tojson( idx ) )
-assert( idx.textIndexVersion >= 1, tojson( idx ) )
+assert( idx.v >= 1, tojson( idx ) );
+assert( idx.textIndexVersion >= 1, tojson( idx ) );
diff --git a/jstests/core/fts_casesensitive.js b/jstests/core/fts_casesensitive.js
index 824bcf52ada..e49de5c1f7f 100644
--- a/jstests/core/fts_casesensitive.js
+++ b/jstests/core/fts_casesensitive.js
@@ -1,6 +1,6 @@
// Integration tests for {$caseSensitive: true} option to $text query operator.
-load('jstests/libs/fts.js')
+load('jstests/libs/fts.js');
var coll = db.fts_casesensitive;
coll.drop();
diff --git a/jstests/core/fts_mix.js b/jstests/core/fts_mix.js
index be42897ebe7..4ef8da0a28d 100644
--- a/jstests/core/fts_mix.js
+++ b/jstests/core/fts_mix.js
@@ -70,7 +70,7 @@ assert.eq( getIDS( res ), getIDS( res2 ) );
// -------------------------------------------- LANGUAGE -------------------------------------------
assert.throws(tc.find( { "$text": { "$search": "member", $language: "spanglish" } } ));
-assert.doesNotThrow(function() {tc.find( { "$text": { "$search": "member", $language: "english" } })} );
+assert.doesNotThrow(function() {tc.find( { "$text": { "$search": "member", $language: "english" } });} );
// -------------------------------------------- LIMIT RESULTS --------------------------------------
diff --git a/jstests/core/fts_partition1.js b/jstests/core/fts_partition1.js
index c5c231db96d..52874f6628b 100644
--- a/jstests/core/fts_partition1.js
+++ b/jstests/core/fts_partition1.js
@@ -1,4 +1,4 @@
-load( "jstests/libs/fts.js" )
+load( "jstests/libs/fts.js" );
t = db.text_parition1;
t.drop();
diff --git a/jstests/core/fts_partition_no_multikey.js b/jstests/core/fts_partition_no_multikey.js
index 29b9c371612..f77dc053f85 100644
--- a/jstests/core/fts_partition_no_multikey.js
+++ b/jstests/core/fts_partition_no_multikey.js
@@ -2,7 +2,7 @@
t = db.fts_partition_no_multikey;
t.drop();
-t.ensureIndex( { x : 1, y : "text" } )
+t.ensureIndex( { x : 1, y : "text" } );
assert.writeOK( t.insert( { x : 5 , y : "this is fun" } ));
diff --git a/jstests/core/fts_phrase.js b/jstests/core/fts_phrase.js
index 75280c81304..471fedbfb42 100644
--- a/jstests/core/fts_phrase.js
+++ b/jstests/core/fts_phrase.js
@@ -1,6 +1,6 @@
t = db.text_phrase;
-t.drop()
+t.drop();
t.save( { _id : 1 , title : "my blog post" , text : "i am writing a blog. yay" } );
t.save( { _id : 2 , title : "my 2nd post" , text : "this is a new blog i am typing. yay" } );
diff --git a/jstests/core/fts_querylang.js b/jstests/core/fts_querylang.js
index 1701273b0a0..4685b6fa550 100644
--- a/jstests/core/fts_querylang.js
+++ b/jstests/core/fts_querylang.js
@@ -52,7 +52,7 @@ assert.eq(results[0]._id, 1);
// Test $and of basic text query with indexed expression, and bad language
assert.throws(function() {
t.find({$text: {$search: "content -irrelevant", $language: "spanglish"}, _id: 1})
- .itcount()});
+ .itcount();});
// Test $and of basic text query with unindexed expression.
results = t.find({$text: {$search: "content -irrelevant"},
@@ -70,7 +70,7 @@ cursor = t.find({$text: {$search: "contents", $language: "EN"}});
assert.eq(true, cursor.hasNext());
cursor = t.find({$text: {$search: "contents", $language: "spanglish"}});
-assert.throws(function() { cursor.next() });
+assert.throws(function() { cursor.next(); });
// TODO Test $and of basic text query with geo expression.
diff --git a/jstests/core/geo1.js b/jstests/core/geo1.js
index 5e28713d581..e1dc23fe153 100644
--- a/jstests/core/geo1.js
+++ b/jstests/core/geo1.js
@@ -1,11 +1,11 @@
-t = db.geo1
+t = db.geo1;
t.drop();
-idx = { loc : "2d" , zip : 1 }
+idx = { loc : "2d" , zip : 1 };
-t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } )
-t.insert( { zip : "10024" , loc : [ 40.786387 , 73.97709 ] } )
+t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } );
+t.insert( { zip : "10024" , loc : [ 40.786387 , 73.97709 ] } );
assert.writeOK( t.insert( { zip : "94061" , loc : [ 37.463911 , 122.23396 ] } ));
// test "2d" has to be first
@@ -22,11 +22,11 @@ assert.eq( 3 , t.count() , "B3" );
// test normal access
-wb = t.findOne( { zip : "06525" } )
+wb = t.findOne( { zip : "06525" } );
assert( wb , "C1" );
-assert.eq( "06525" , t.find( { loc : wb.loc } ).hint( { "$natural" : 1 } )[0].zip , "C2" )
-assert.eq( "06525" , t.find( { loc : wb.loc } )[0].zip , "C3" )
+assert.eq( "06525" , t.find( { loc : wb.loc } ).hint( { "$natural" : 1 } )[0].zip , "C2" );
+assert.eq( "06525" , t.find( { loc : wb.loc } )[0].zip , "C3" );
// assert.eq( 1 , t.find( { loc : wb.loc } ).explain().nscanned , "C4" )
// test config options
diff --git a/jstests/core/geo10.js b/jstests/core/geo10.js
index 25bfc7b8ce6..5c26fbb3609 100644
--- a/jstests/core/geo10.js
+++ b/jstests/core/geo10.js
@@ -1,13 +1,13 @@
// Test for SERVER-2746
-coll = db.geo10
+coll = db.geo10;
coll.drop();
assert.commandWorked( db.geo10.ensureIndex( { c : '2d', t : 1 }, { min : 0, max : Math.pow( 2, 40 ) } ));
-assert.eq( 2, db.geo10.getIndexes().length, "A3" )
+assert.eq( 2, db.geo10.getIndexes().length, "A3" );
assert.writeOK( db.geo10.insert( { c : [ 1, 1 ], t : 1 } ));
assert.writeOK( db.geo10.insert( { c : [ 3600, 3600 ], t : 1 } ));
assert.writeOK( db.geo10.insert( { c : [ 0.001, 0.001 ], t : 1 } ));
-printjson( db.geo10.find({ c : { $within : { $box : [[0.001, 0.001], [Math.pow(2, 40) - 0.001, Math.pow(2, 40) - 0.001]] } }, t : 1 }).toArray() )
+printjson( db.geo10.find({ c : { $within : { $box : [[0.001, 0.001], [Math.pow(2, 40) - 0.001, Math.pow(2, 40) - 0.001]] } }, t : 1 }).toArray() );
diff --git a/jstests/core/geo2.js b/jstests/core/geo2.js
index 4691eb8d6d5..4317d044f76 100644
--- a/jstests/core/geo2.js
+++ b/jstests/core/geo2.js
@@ -1,5 +1,5 @@
-t = db.geo2
+t = db.geo2;
t.drop();
n = 1;
@@ -14,7 +14,7 @@ assert.eq( t.count(), 100 * 100 );
assert.eq( t.count(), n - 1 );
-t.ensureIndex( { loc : "2d" } )
+t.ensureIndex( { loc : "2d" } );
fast = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 } );
@@ -29,17 +29,17 @@ function a( cur ){
return total/outof;
}
-assert.close( fast.stats.avgDistance , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(10) ) , "B1" )
+assert.close( fast.stats.avgDistance , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(10) ) , "B1" );
assert.close( 1.33333 , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(3) ) , "B2" );
assert.close( fast.stats.avgDistance , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(10) ) , "B3" );
-printjson( t.find( { loc : { $near : [ 50 , 50 ] } } ).explain() )
+printjson( t.find( { loc : { $near : [ 50 , 50 ] } } ).explain() );
-assert.lt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(50) ) , "C1" )
-assert.gt( 3 , a( t.find( { loc : { $near : [ 50 , 50 , 3 ] } } ).limit(50) ) , "C2" )
-assert.gt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] , $maxDistance : 3 } } ).limit(50) ) , "C3" )
+assert.lt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(50) ) , "C1" );
+assert.gt( 3 , a( t.find( { loc : { $near : [ 50 , 50 , 3 ] } } ).limit(50) ) , "C2" );
+assert.gt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] , $maxDistance : 3 } } ).limit(50) ) , "C3" );
// SERVER-8974 - test if $geoNear operator works with 2d index as well
var geoNear_cursor = t.find( { loc : { $geoNear : [50, 50] } } ).limit(100);
-assert.eq( geoNear_cursor.count(true), 100 )
+assert.eq( geoNear_cursor.count(true), 100 );
diff --git a/jstests/core/geo3.js b/jstests/core/geo3.js
index 934fa15908a..a11c24ed338 100644
--- a/jstests/core/geo3.js
+++ b/jstests/core/geo3.js
@@ -1,5 +1,5 @@
-t = db.geo3
+t = db.geo3;
t.drop();
n = 1;
@@ -14,7 +14,7 @@ assert.eq( t.count(), 100 * 100 );
assert.eq( t.count(), n - 1 );
-t.ensureIndex( { loc : "2d" } )
+t.ensureIndex( { loc : "2d" } );
fast = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 } );
@@ -22,7 +22,7 @@ fast = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 }
filtered1 = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
assert.eq( 10 , filtered1.results.length , "B1" );
-filtered1.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B2: " + tojson( z ) ); } )
+filtered1.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B2: " + tojson( z ) ); } );
//printjson( filtered1.stats );
function avgA( q , len ){
@@ -49,35 +49,35 @@ function testFiltering( msg ){
testFiltering( "just loc" );
-t.dropIndex( { loc : "2d" } )
-assert.eq( 1 , t.getIndexKeys().length , "setup 3a" )
-t.ensureIndex( { loc : "2d" , a : 1 } )
-assert.eq( 2 , t.getIndexKeys().length , "setup 3b" )
+t.dropIndex( { loc : "2d" } );
+assert.eq( 1 , t.getIndexKeys().length , "setup 3a" );
+t.ensureIndex( { loc : "2d" , a : 1 } );
+assert.eq( 2 , t.getIndexKeys().length , "setup 3b" );
filtered2 = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
assert.eq( 10 , filtered2.results.length , "B3" );
-filtered2.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B4: " + tojson( z ) ); } )
+filtered2.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B4: " + tojson( z ) ); } );
-assert.eq( filtered1.stats.avgDistance , filtered2.stats.avgDistance , "C1" )
-assert.gt( filtered1.stats.objectsLoaded , filtered2.stats.objectsLoaded , "C3" )
+assert.eq( filtered1.stats.avgDistance , filtered2.stats.avgDistance , "C1" );
+assert.gt( filtered1.stats.objectsLoaded , filtered2.stats.objectsLoaded , "C3" );
testFiltering( "loc and a" );
-t.dropIndex( { loc : "2d" , a : 1 } )
-assert.eq( 1 , t.getIndexKeys().length , "setup 4a" )
-t.ensureIndex( { loc : "2d" , b : 1 } )
-assert.eq( 2 , t.getIndexKeys().length , "setup 4b" )
+t.dropIndex( { loc : "2d" , a : 1 } );
+assert.eq( 1 , t.getIndexKeys().length , "setup 4a" );
+t.ensureIndex( { loc : "2d" , b : 1 } );
+assert.eq( 2 , t.getIndexKeys().length , "setup 4b" );
testFiltering( "loc and b" );
-q = { loc : { $near : [ 50 , 50 ] } }
-assert.eq( 100 , t.find( q ).limit(100).itcount() , "D1" )
-assert.eq( 100 , t.find( q ).limit(100).size() , "D2" )
+q = { loc : { $near : [ 50 , 50 ] } };
+assert.eq( 100 , t.find( q ).limit(100).itcount() , "D1" );
+assert.eq( 100 , t.find( q ).limit(100).size() , "D2" );
-assert.eq( 20 , t.find( q ).limit(20).itcount() , "D3" )
-assert.eq( 20 , t.find( q ).limit(20).size() , "D4" )
+assert.eq( 20 , t.find( q ).limit(20).itcount() , "D3" );
+assert.eq( 20 , t.find( q ).limit(20).size() , "D4" );
// SERVER-14039 Wrong limit after skip with $nearSphere, 2d index
-assert.eq( 10 , t.find( q ).skip(10).limit(10).itcount() , "D5" )
-assert.eq( 10 , t.find( q ).skip(10).limit(10).size() , "D6" )
+assert.eq( 10 , t.find( q ).skip(10).limit(10).itcount() , "D5" );
+assert.eq( 10 , t.find( q ).skip(10).limit(10).size() , "D6" );
diff --git a/jstests/core/geo5.js b/jstests/core/geo5.js
index 67b00f85b44..1a0830113e9 100644
--- a/jstests/core/geo5.js
+++ b/jstests/core/geo5.js
@@ -1,18 +1,18 @@
t = db.geo5;
t.drop();
-t.insert( { p : [ 0,0 ] } )
-t.ensureIndex( { p : "2d" } )
+t.insert( { p : [ 0,0 ] } );
+t.ensureIndex( { p : "2d" } );
res = t.runCommand( "geoNear" , { near : [1,1] } );
assert.eq( 1 , res.results.length , "A1" );
-t.insert( { p : [ 1,1 ] } )
-t.insert( { p : [ -1,-1 ] } )
+t.insert( { p : [ 1,1 ] } );
+t.insert( { p : [ -1,-1 ] } );
res = t.runCommand( "geoNear" , { near : [50,50] } );
assert.eq( 3 , res.results.length , "A2" );
-t.insert( { p : [ -1,-1 ] } )
+t.insert( { p : [ -1,-1 ] } );
res = t.runCommand( "geoNear" , { near : [50,50] } );
assert.eq( 4 , res.results.length , "A3" );
diff --git a/jstests/core/geo6.js b/jstests/core/geo6.js
index 185795c57ba..e57f8a6b6f6 100644
--- a/jstests/core/geo6.js
+++ b/jstests/core/geo6.js
@@ -5,20 +5,20 @@ t.drop();
t.ensureIndex( { loc : "2d" } );
assert.eq( 0 , t.find().itcount() , "pre0" );
-assert.eq( 0 , t.find( { loc : { $near : [50,50] } } ).itcount() , "pre1" )
+assert.eq( 0 , t.find( { loc : { $near : [50,50] } } ).itcount() , "pre1" );
-t.insert( { _id : 1 , loc : [ 1 , 1 ] } )
-t.insert( { _id : 2 , loc : [ 1 , 2 ] } )
-t.insert( { _id : 3 } )
+t.insert( { _id : 1 , loc : [ 1 , 1 ] } );
+t.insert( { _id : 2 , loc : [ 1 , 2 ] } );
+t.insert( { _id : 3 } );
-assert.eq( 3 , t.find().itcount() , "A1" )
-assert.eq( 2 , t.find().hint( { loc : "2d" } ).itcount() , "A2" )
-assert.eq( 2 , t.find( { loc : { $near : [50,50] } } ).itcount() , "A3" )
+assert.eq( 3 , t.find().itcount() , "A1" );
+assert.eq( 2 , t.find().hint( { loc : "2d" } ).itcount() , "A2" );
+assert.eq( 2 , t.find( { loc : { $near : [50,50] } } ).itcount() , "A3" );
t.find( { loc : { $near : [50,50] } } ).sort( { _id : 1 } ).forEach(printjson);
-assert.eq( 1 , t.find( { loc : { $near : [50,50] } } ).sort( { _id : 1 } ).next()._id , "B1" )
-assert.eq( 2 , t.find( { loc : { $near : [50,50] } } ).sort( { _id : -1 } ).next()._id , "B1" )
+assert.eq( 1 , t.find( { loc : { $near : [50,50] } } ).sort( { _id : 1 } ).next()._id , "B1" );
+assert.eq( 2 , t.find( { loc : { $near : [50,50] } } ).sort( { _id : -1 } ).next()._id , "B1" );
-t.insert( { _id : 4 , loc : [] } )
-assert.eq( 4 , t.find().itcount() , "C1" )
+t.insert( { _id : 4 , loc : [] } );
+assert.eq( 4 , t.find().itcount() , "C1" );
diff --git a/jstests/core/geo7.js b/jstests/core/geo7.js
index c220da54249..f353f75d789 100644
--- a/jstests/core/geo7.js
+++ b/jstests/core/geo7.js
@@ -2,18 +2,18 @@
t = db.geo7;
t.drop();
-t.insert({_id:1,y:[1,1]})
-t.insert({_id:2,y:[1,1],z:3})
-t.insert({_id:3,y:[1,1],z:4})
-t.insert({_id:4,y:[1,1],z:5})
+t.insert({_id:1,y:[1,1]});
+t.insert({_id:2,y:[1,1],z:3});
+t.insert({_id:3,y:[1,1],z:4});
+t.insert({_id:4,y:[1,1],z:5});
-t.ensureIndex({y:"2d",z:1})
+t.ensureIndex({y:"2d",z:1});
assert.eq( 1 , t.find({y:[1,1],z:3}).itcount() , "A1" );
-t.dropIndex({y:"2d",z:1})
+t.dropIndex({y:"2d",z:1});
-t.ensureIndex({y:"2d"})
+t.ensureIndex({y:"2d"});
assert.eq( 1 , t.find({y:[1,1],z:3}).itcount() , "A2" );
t.insert( { _id : 5 , y : 5 } );
diff --git a/jstests/core/geo9.js b/jstests/core/geo9.js
index 8b6510f03b5..1e295911393 100644
--- a/jstests/core/geo9.js
+++ b/jstests/core/geo9.js
@@ -1,21 +1,21 @@
-t = db.geo9
+t = db.geo9;
t.drop();
-t.save( { _id : 1 , a : [ 10 , 10 ] , b : [ 50 , 50 ] } )
-t.save( { _id : 2 , a : [ 11 , 11 ] , b : [ 51 , 52 ] } )
-t.save( { _id : 3 , a : [ 12 , 12 ] , b : [ 52 , 52 ] } )
+t.save( { _id : 1 , a : [ 10 , 10 ] , b : [ 50 , 50 ] } );
+t.save( { _id : 2 , a : [ 11 , 11 ] , b : [ 51 , 52 ] } );
+t.save( { _id : 3 , a : [ 12 , 12 ] , b : [ 52 , 52 ] } );
-t.save( { _id : 4 , a : [ 50 , 50 ] , b : [ 10 , 10 ] } )
-t.save( { _id : 5 , a : [ 51 , 51 ] , b : [ 11 , 11 ] } )
-t.save( { _id : 6 , a : [ 52 , 52 ] , b : [ 12 , 12 ] } )
+t.save( { _id : 4 , a : [ 50 , 50 ] , b : [ 10 , 10 ] } );
+t.save( { _id : 5 , a : [ 51 , 51 ] , b : [ 11 , 11 ] } );
+t.save( { _id : 6 , a : [ 52 , 52 ] , b : [ 12 , 12 ] } );
-t.ensureIndex( { a : "2d" } )
-t.ensureIndex( { b : "2d" } )
+t.ensureIndex( { a : "2d" } );
+t.ensureIndex( { b : "2d" } );
function check( field ){
- var q = {}
- q[field] = { $near : [ 11 , 11 ] }
+ var q = {};
+ q[field] = { $near : [ 11 , 11 ] };
arr = t.find( q ).limit(3).map(
function(z){
return Geo.distance( [ 11 , 11 ] , z[field] );
@@ -24,5 +24,5 @@ function check( field ){
assert.eq( 2 * Math.sqrt( 2 ) , Array.sum( arr ) , "test " + field );
}
-check( "a" )
-check( "b" )
+check( "a" );
+check( "b" );
diff --git a/jstests/core/geo_2d_explain.js b/jstests/core/geo_2d_explain.js
index 68f923865f9..c7bde9ef97b 100644
--- a/jstests/core/geo_2d_explain.js
+++ b/jstests/core/geo_2d_explain.js
@@ -7,8 +7,8 @@ t.drop();
var n = 1000;
// insert n documents with integer _id, a can be 1-5, loc is close to [40, 40]
-t.drop()
-t.ensureIndex({loc: "2d", _id: 1})
+t.drop();
+t.ensureIndex({loc: "2d", _id: 1});
var x = 40;
var y = 40;
diff --git a/jstests/core/geo_allowedcomparisons.js b/jstests/core/geo_allowedcomparisons.js
index 121492a26d4..e1a36d495eb 100644
--- a/jstests/core/geo_allowedcomparisons.js
+++ b/jstests/core/geo_allowedcomparisons.js
@@ -10,14 +10,14 @@ geojsonPoly = { "type" : "Polygon",
"coordinates" : [ [ [-5,-5], [-5,5], [5,5], [5,-5], [-5,-5]]]};
// This can be contained by GJ polygons, intersected by anything GJ and old points.
-geojsonLine = { "type" : "LineString", "coordinates": [ [ 0, 0], [1, 1]]}
+geojsonLine = { "type" : "LineString", "coordinates": [ [ 0, 0], [1, 1]]};
// $centerSphere can contain old or new points.
oldCenterSphere = [[0, 0], Math.PI / 180];
// $box can contain old points.
oldBox = [[-5,-5], [5,5]];
// $polygon can contain old points.
-oldPolygon = [[-5,-5], [-5,5], [5,5], [5,-5], [-5,-5]]
+oldPolygon = [[-5,-5], [-5,5], [5,5], [5,-5], [-5,-5]];
// $center can contain old points.
oldCenter = [[0, 0], 1];
@@ -37,49 +37,49 @@ assert.writeError(t.insert({geo: oldCenter}));
// do that. Ditto for the box.
// Verify that even if we can't index them, we can use them in a matcher.
-t.insert({gj: geojsonLine})
-t.insert({gj: geojsonPoly})
+t.insert({gj: geojsonLine});
+t.insert({gj: geojsonPoly});
geojsonPoint2 = { "type" : "Point", "coordinates": [ 0, 0.001 ] };
-t.insert({gjp: geojsonPoint2})
+t.insert({gjp: geojsonPoint2});
// We convert between old and new style points.
assert.eq(1, t.find({gjp: {$geoWithin: {$box: oldBox}}}).itcount());
assert.eq(1, t.find({gjp: {$geoWithin: {$polygon: oldPolygon}}}).itcount());
assert.eq(1, t.find({gjp: {$geoWithin: {$center: oldCenter}}}).itcount());
-assert.eq(1, t.find({gjp: {$geoWithin: {$centerSphere: oldCenterSphere}}}).itcount())
+assert.eq(1, t.find({gjp: {$geoWithin: {$centerSphere: oldCenterSphere}}}).itcount());
function runTests() {
// Each find the box, the polygon, and the old point.
- assert.eq(1, t.find({geo: {$geoWithin: {$box: oldBox}}}).itcount())
- assert.eq(1, t.find({geo: {$geoWithin: {$polygon: oldPolygon}}}).itcount())
+ assert.eq(1, t.find({geo: {$geoWithin: {$box: oldBox}}}).itcount());
+ assert.eq(1, t.find({geo: {$geoWithin: {$polygon: oldPolygon}}}).itcount());
// Each find the old point.
- assert.eq(1, t.find({geo: {$geoWithin: {$center: oldCenter}}}).itcount())
- assert.eq(1, t.find({geo: {$geoWithin: {$centerSphere: oldCenterSphere}}}).itcount())
+ assert.eq(1, t.find({geo: {$geoWithin: {$center: oldCenter}}}).itcount());
+ assert.eq(1, t.find({geo: {$geoWithin: {$centerSphere: oldCenterSphere}}}).itcount());
// Using geojson with 2d-style geoWithin syntax should choke.
assert.throws(function() { return t.find({geo: {$geoWithin: {$polygon: geojsonPoly}}})
- .itcount();})
+ .itcount();});
// Using old polygon w/new syntax should choke too.
assert.throws(function() { return t.find({geo: {$geoWithin: {$geometry: oldPolygon}}})
- .itcount();})
+ .itcount();});
assert.throws(function() { return t.find({geo: {$geoWithin: {$geometry: oldBox}}})
- .itcount();})
+ .itcount();});
assert.throws(function() { return t.find({geo: {$geoWithin: {$geometry: oldCenter}}})
- .itcount();})
+ .itcount();});
assert.throws(function() { return t.find({geo: {$geoWithin: {$geometry: oldCenterSphere}}})
- .itcount();})
+ .itcount();});
// Even if we only have a 2d index, the 2d suitability function should
// allow the matcher to deal with this. If we have a 2dsphere index we use it.
- assert.eq(1, t.find({geo: {$geoWithin: {$geometry: geojsonPoly}}}).itcount())
- assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: geojsonPoly}}}).itcount())
- assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: oldPoint}}}).itcount())
- assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: geojsonPoint}}}).itcount())
+ assert.eq(1, t.find({geo: {$geoWithin: {$geometry: geojsonPoly}}}).itcount());
+ assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: geojsonPoly}}}).itcount());
+ assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: oldPoint}}}).itcount());
+ assert.eq(1, t.find({geo: {$geoIntersects: {$geometry: geojsonPoint}}}).itcount());
}
// We have a 2d index right now. Let's see what it does.
runTests();
// No index now.
-t.dropIndex({geo: "2d"})
+t.dropIndex({geo: "2d"});
runTests();
// 2dsphere index now.
diff --git a/jstests/core/geo_array0.js b/jstests/core/geo_array0.js
index bb4f439f303..c83223cef05 100644
--- a/jstests/core/geo_array0.js
+++ b/jstests/core/geo_array0.js
@@ -1,26 +1,26 @@
// Make sure the very basics of geo arrays are sane by creating a few multi location docs
-t = db.geoarray
+t = db.geoarray;
function test(index) {
t.drop();
- t.insert( { zip : "10001", loc : [[ 10, 10 ], [ 50, 50 ]] } )
- t.insert( { zip : "10002", loc : [[ 20, 20 ], [ 50, 50 ]] } )
+ t.insert( { zip : "10001", loc : [[ 10, 10 ], [ 50, 50 ]] } );
+ t.insert( { zip : "10002", loc : [[ 20, 20 ], [ 50, 50 ]] } );
var res = t.insert( { zip : "10003", loc : [[ 30, 30 ], [ 50, 50 ]] } );
assert.writeOK( res );
if (index) {
assert.commandWorked(t.ensureIndex( { loc : "2d", zip : 1 } ));
- assert.eq( 2, t.getIndexKeys().length )
+ assert.eq( 2, t.getIndexKeys().length );
}
res = t.insert( { zip : "10004", loc : [[ 40, 40 ], [ 50, 50 ]] } );
assert.writeOK( res );
// test normal access
- printjson( t.find( { loc : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() )
+ printjson( t.find( { loc : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() );
assert.eq( 4, t.find( { loc : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).count() );
assert.eq( 4, t.find( { loc : { $within : { $box : [ [ 45, 45 ], [ 50, 50 ] ] } } } ).count() );
}
//test(false); // this was removed as part of SERVER-6400
-test(true)
+test(true);
diff --git a/jstests/core/geo_array1.js b/jstests/core/geo_array1.js
index ca61050c888..c37c80b21e0 100644
--- a/jstests/core/geo_array1.js
+++ b/jstests/core/geo_array1.js
@@ -1,27 +1,27 @@
// Make sure many locations in one doc works, in the form of an array
-t = db.geoarray1
+t = db.geoarray1;
function test(index) {
t.drop();
- var locObj = []
+ var locObj = [];
// Add locations everywhere
for ( var i = 0; i < 10; i++ ) {
for ( var j = 0; j < 10; j++ ) {
if ( j % 2 == 0 )
- locObj.push( [ i, j ] )
+ locObj.push( [ i, j ] );
else
- locObj.push( { x : i, y : j } )
+ locObj.push( { x : i, y : j } );
}
}
// Add docs with all these locations
for( var i = 0; i < 300; i++ ){
- t.insert( { loc : locObj } )
+ t.insert( { loc : locObj } );
}
if (index) {
- t.ensureIndex( { loc : "2d" } )
+ t.ensureIndex( { loc : "2d" } );
}
// Pull them back
@@ -29,10 +29,10 @@ function test(index) {
for ( var j = 0; j < 10; j++ ) {
assert.eq(300, t.find({loc: {$within: {$box: [[i - 0.5, j - 0.5 ],
[i + 0.5,j + 0.5]]}}})
- .count())
+ .count());
}
}
}
-test(true)
-test(false)
+test(true);
+test(false);
diff --git a/jstests/core/geo_array2.js b/jstests/core/geo_array2.js
index aa444d8272a..68ecb65323e 100644
--- a/jstests/core/geo_array2.js
+++ b/jstests/core/geo_array2.js
@@ -1,6 +1,6 @@
// Check the semantics of near calls with multiple locations
-t = db.geoarray2
+t = db.geoarray2;
t.drop();
var numObjs = 10;
@@ -13,142 +13,142 @@ Random.setRandomSeed();
for( var i = -1; i < 2; i++ ){
for(var j = -1; j < 2; j++ ){
- locObj = []
+ locObj = [];
if( i != 0 || j != 0 )
locObj.push( { x : i * 50 + Random.rand(),
- y : j * 50 + Random.rand() } )
+ y : j * 50 + Random.rand() } );
locObj.push( { x : Random.rand(),
- y : Random.rand() } )
+ y : Random.rand() } );
locObj.push( { x : Random.rand(),
- y : Random.rand() } )
+ y : Random.rand() } );
- t.insert({ name : "" + i + "" + j , loc : locObj , type : "A" })
- t.insert({ name : "" + i + "" + j , loc : locObj , type : "B" })
+ t.insert({ name : "" + i + "" + j , loc : locObj , type : "A" });
+ t.insert({ name : "" + i + "" + j , loc : locObj , type : "B" });
}
}
assert.commandWorked(t.ensureIndex({ loc : "2d" , type : 1 }));
-print( "Starting testing phase... ")
+print( "Starting testing phase... ");
for( var t = 0; t < 2; t++ ){
-var type = t == 0 ? "A" : "B"
+var type = t == 0 ? "A" : "B";
for( var i = -1; i < 2; i++ ){
for(var j = -1; j < 2; j++ ){
- var center = [ i * 50 , j * 50 ]
- var count = i == 0 && j == 0 ? 9 : 1
- var objCount = 1
+ var center = [ i * 50 , j * 50 ];
+ var count = i == 0 && j == 0 ? 9 : 1;
+ var objCount = 1;
// Do near check
var nearResults = db.runCommand( { geoNear : "geoarray2" ,
near : center ,
num : count,
- query : { type : type } } ).results
+ query : { type : type } } ).results;
//printjson( nearResults )
- var objsFound = {}
+ var objsFound = {};
var lastResult = 0;
for( var k = 0; k < nearResults.length; k++ ){
// All distances should be small, for the # of results
- assert.gt( 1.5 , nearResults[k].dis )
+ assert.gt( 1.5 , nearResults[k].dis );
// Distances should be increasing
- assert.lte( lastResult, nearResults[k].dis )
+ assert.lte( lastResult, nearResults[k].dis );
// Objs should be of the right type
- assert.eq( type, nearResults[k].obj.type )
+ assert.eq( type, nearResults[k].obj.type );
- lastResult = nearResults[k].dis
+ lastResult = nearResults[k].dis;
- var objKey = "" + nearResults[k].obj._id
+ var objKey = "" + nearResults[k].obj._id;
- if( objKey in objsFound ) objsFound[ objKey ]++
- else objsFound[ objKey ] = 1
+ if( objKey in objsFound ) objsFound[ objKey ]++;
+ else objsFound[ objKey ] = 1;
}
// Make sure we found the right objects each time
// Note: Multiple objects could be found for diff distances.
for( var q in objsFound ){
- assert.eq( objCount , objsFound[q] )
+ assert.eq( objCount , objsFound[q] );
}
// Do nearSphere check
// Earth Radius from geoconstants.h
- var eRad = 6378.1
+ var eRad = 6378.1;
- nearResults = db.geoarray2.find( { loc : { $nearSphere : center , $maxDistance : 500 /* km */ / eRad }, type : type } ).toArray()
+ nearResults = db.geoarray2.find( { loc : { $nearSphere : center , $maxDistance : 500 /* km */ / eRad }, type : type } ).toArray();
- assert.eq( nearResults.length , count )
+ assert.eq( nearResults.length , count );
- objsFound = {}
+ objsFound = {};
lastResult = 0;
for( var k = 0; k < nearResults.length; k++ ){
- var objKey = "" + nearResults[k]._id
- if( objKey in objsFound ) objsFound[ objKey ]++
- else objsFound[ objKey ] = 1
+ var objKey = "" + nearResults[k]._id;
+ if( objKey in objsFound ) objsFound[ objKey ]++;
+ else objsFound[ objKey ] = 1;
}
// Make sure we found the right objects each time
for( var q in objsFound ){
- assert.eq( objCount , objsFound[q] )
+ assert.eq( objCount , objsFound[q] );
}
// Within results do not return duplicate documents
- var count = i == 0 && j == 0 ? 9 : 1
- var objCount = i == 0 && j == 0 ? 1 : 1
+ var count = i == 0 && j == 0 ? 9 : 1;
+ var objCount = i == 0 && j == 0 ? 1 : 1;
// Do within check
- objsFound = {}
+ objsFound = {};
- var box = [ [center[0] - 1, center[1] - 1] , [center[0] + 1, center[1] + 1] ]
+ var box = [ [center[0] - 1, center[1] - 1] , [center[0] + 1, center[1] + 1] ];
//printjson( box )
- var withinResults = db.geoarray2.find({ loc : { $within : { $box : box } } , type : type }).toArray()
+ var withinResults = db.geoarray2.find({ loc : { $within : { $box : box } } , type : type }).toArray();
- assert.eq( withinResults.length , count )
+ assert.eq( withinResults.length , count );
for( var k = 0; k < withinResults.length; k++ ){
- var objKey = "" + withinResults[k]._id
- if( objKey in objsFound ) objsFound[ objKey ]++
- else objsFound[ objKey ] = 1
+ var objKey = "" + withinResults[k]._id;
+ if( objKey in objsFound ) objsFound[ objKey ]++;
+ else objsFound[ objKey ] = 1;
}
//printjson( objsFound )
// Make sure we found the right objects each time
for( var q in objsFound ){
- assert.eq( objCount , objsFound[q] )
+ assert.eq( objCount , objsFound[q] );
}
// Do within check (circle)
- objsFound = {}
+ objsFound = {};
- withinResults = db.geoarray2.find({ loc : { $within : { $center : [ center, 1.5 ] } } , type : type }).toArray()
+ withinResults = db.geoarray2.find({ loc : { $within : { $center : [ center, 1.5 ] } } , type : type }).toArray();
- assert.eq( withinResults.length , count )
+ assert.eq( withinResults.length , count );
for( var k = 0; k < withinResults.length; k++ ){
- var objKey = "" + withinResults[k]._id
- if( objKey in objsFound ) objsFound[ objKey ]++
- else objsFound[ objKey ] = 1
+ var objKey = "" + withinResults[k]._id;
+ if( objKey in objsFound ) objsFound[ objKey ]++;
+ else objsFound[ objKey ] = 1;
}
// Make sure we found the right objects each time
for( var q in objsFound ){
- assert.eq( objCount , objsFound[q] )
+ assert.eq( objCount , objsFound[q] );
}
diff --git a/jstests/core/geo_borders.js b/jstests/core/geo_borders.js
index 6443a940c02..4768ff8503f 100644
--- a/jstests/core/geo_borders.js
+++ b/jstests/core/geo_borders.js
@@ -1,23 +1,23 @@
-t = db.borders
-t.drop()
+t = db.borders;
+t.drop();
epsilon = 0.0001;
// For these tests, *required* that step ends exactly on max
-min = -1
-max = 1
-step = 1
+min = -1;
+max = 1;
+step = 1;
numItems = 0;
for ( var x = min; x <= max; x += step ) {
for ( var y = min; y <= max; y += step ) {
- t.insert( { loc : { x : x, y : y } } )
+ t.insert( { loc : { x : x, y : y } } );
numItems++;
}
}
-overallMin = -1
-overallMax = 1
+overallMin = -1;
+overallMax = 1;
// Create a point index slightly smaller than the points we have
var res = t.ensureIndex({ loc: "2d" },
@@ -72,14 +72,14 @@ assert.eq( numItems, t.find(
// Circle tests
// **************
-center = ( overallMax + overallMin ) / 2
-center = [ center, center ]
-radius = overallMax
+center = ( overallMax + overallMin ) / 2;
+center = [ center, center ];
+radius = overallMax;
-offCenter = [ center[0] + radius, center[1] + radius ]
-onBounds = [ offCenter[0] + epsilon, offCenter[1] + epsilon ]
-offBounds = [ onBounds[0] + epsilon, onBounds[1] + epsilon ]
-onBoundsNeg = [ -onBounds[0], -onBounds[1] ]
+offCenter = [ center[0] + radius, center[1] + radius ];
+onBounds = [ offCenter[0] + epsilon, offCenter[1] + epsilon ];
+offBounds = [ onBounds[0] + epsilon, onBounds[1] + epsilon ];
+onBoundsNeg = [ -onBounds[0], -onBounds[1] ];
// Make sure we can get all points when radius is exactly at full bounds
assert.lt( 0, t.find( { loc : { $within : { $center : [ center, radius + epsilon ] } } } ).count() );
@@ -93,13 +93,13 @@ assert.lt( 0, t.find( { loc : { $within : { $center : [ offCenter, radius + 2 *
// Make sure we get correct corner point when center is in bounds
// (x bounds wrap, so could get other corner)
cornerPt = t.findOne( { loc : { $within : { $center : [ offCenter, step / 2 ] } } } );
-assert.eq( cornerPt.loc.y, overallMax )
+assert.eq( cornerPt.loc.y, overallMax );
// Make sure we get correct corner point when center is on bounds
// NOTE: Only valid points on MIN bounds
cornerPt = t
.findOne( { loc : { $within : { $center : [ onBoundsNeg, Math.sqrt( 2 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
-assert.eq( cornerPt.loc.y, overallMin )
+assert.eq( cornerPt.loc.y, overallMin );
// Make sure we can't get corner point when center is over bounds
// TODO: SERVER-5800 clean up wrapping rules for different CRS queries - not sure this is an error
diff --git a/jstests/core/geo_box1.js b/jstests/core/geo_box1.js
index e1e7ef113f4..ee21f02df0c 100644
--- a/jstests/core/geo_box1.js
+++ b/jstests/core/geo_box1.js
@@ -5,8 +5,8 @@ t.drop();
num = 0;
for ( x=0; x<=20; x++ ){
for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ o = { _id : num++ , loc : [ x , y ] };
+ t.save( o );
}
}
@@ -24,25 +24,25 @@ for ( i=0; i<searches.length; i++ ){
b = searches[i];
//printjson( b );
- q = { loc : { $within : { $box : b } } }
+ q = { loc : { $within : { $box : b } } };
numWanetd = ( 1 + b[1][0] - b[0][0] ) * ( 1 + b[1][1] - b[0][1] );
assert.eq( numWanetd , t.find(q).itcount() , "itcount: " + tojson( q ) );
- printjson( t.find(q).explain() )
+ printjson( t.find(q).explain() );
}
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).itcount() , "E1" )
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).count() , "E2" )
+assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).itcount() , "E1" );
+assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).count() , "E2" );
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).count() , "E3" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).itcount() , "E4" )
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).count() , "E3" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).itcount() , "E4" );
-assert.eq( 57 , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).limit(57).itcount() , "E5" )
+assert.eq( 57 , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).limit(57).itcount() , "E5" );
// SERVER-13621
// Eetect and invert the $box coordinates when they're specified incorrectly.
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 110 ], [ 0 , 0 ] ] } } } ).count() , "E5" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 0 ], [ 0 , 110 ] ] } } } ).count() , "E6" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 110 ], [ 110 , 0 ] ] } } } ).count() , "E7" )
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 110 ], [ 0 , 0 ] ] } } } ).count() , "E5" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 0 ], [ 0 , 110 ] ] } } } ).count() , "E6" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 110 ], [ 110 , 0 ] ] } } } ).count() , "E7" );
diff --git a/jstests/core/geo_box1_noindex.js b/jstests/core/geo_box1_noindex.js
index 923765b0fa9..abf21266dac 100644
--- a/jstests/core/geo_box1_noindex.js
+++ b/jstests/core/geo_box1_noindex.js
@@ -5,8 +5,8 @@ t.drop();
num = 0;
for ( x=0; x<=20; x++ ){
for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ o = { _id : num++ , loc : [ x , y ] };
+ t.save( o );
}
}
@@ -19,20 +19,20 @@ searches = [
for ( i=0; i<searches.length; i++ ){
b = searches[i];
- q = { loc : { $within : { $box : b } } }
+ q = { loc : { $within : { $box : b } } };
numWanted = ( 1 + b[1][0] - b[0][0] ) * ( 1 + b[1][1] - b[0][1] );
assert.eq( numWanted , t.find(q).itcount() , "itcount: " + tojson( q ) );
- printjson( t.find(q).explain() )
+ printjson( t.find(q).explain() );
}
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).itcount() , "E1" )
-assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).count() , "E2" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).count() , "E3" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).itcount() , "E4" )
-assert.eq( 57 , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).limit(57).itcount() , "E5" )
+assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).itcount() , "E1" );
+assert.eq( 0 , t.find( { loc : { $within : { $box : [ [100 , 100 ] , [ 110 , 110 ] ] } } } ).count() , "E2" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).count() , "E3" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).itcount() , "E4" );
+assert.eq( 57 , t.find( { loc : { $within : { $box : [ [ 0 , 0 ] , [ 110 , 110 ] ] } } } ).limit(57).itcount() , "E5" );
// SERVER-13621
// Eetect and invert the $box coordinates when they're specified incorrectly.
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 110 ], [ 0 , 0 ] ] } } } ).count() , "E5" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 0 ], [ 0 , 110 ] ] } } } ).count() , "E6" )
-assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 110 ], [ 110 , 0 ] ] } } } ).count() , "E7" )
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 110 ], [ 0 , 0 ] ] } } } ).count() , "E5" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 110 , 0 ], [ 0 , 110 ] ] } } } ).count() , "E6" );
+assert.eq( num , t.find( { loc : { $within : { $box : [ [ 0 , 110 ], [ 110 , 0 ] ] } } } ).count() , "E7" );
diff --git a/jstests/core/geo_box2.js b/jstests/core/geo_box2.js
index dd114ae5c2e..c20a1701874 100644
--- a/jstests/core/geo_box2.js
+++ b/jstests/core/geo_box2.js
@@ -1,7 +1,7 @@
t = db.geo_box2;
-t.drop()
+t.drop();
for (i=1; i<10; i++) {
for(j=1; j<10; j++) {
@@ -9,10 +9,10 @@ for (i=1; i<10; i++) {
}
}
-t.ensureIndex({"loc" : "2d"} )
+t.ensureIndex({"loc" : "2d"} );
assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "A1" );
-t.dropIndex( { "loc" : "2d" } )
+t.dropIndex( { "loc" : "2d" } );
-t.ensureIndex({"loc" : "2d"} , {"min" : 0, "max" : 10})
+t.ensureIndex({"loc" : "2d"} , {"min" : 0, "max" : 10});
assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "B1" );
diff --git a/jstests/core/geo_center_sphere1.js b/jstests/core/geo_center_sphere1.js
index a5659391208..2c61a54588b 100644
--- a/jstests/core/geo_center_sphere1.js
+++ b/jstests/core/geo_center_sphere1.js
@@ -2,7 +2,7 @@ t = db.geo_center_sphere1;
function test(index) {
t.drop();
- skip = 8 // lower for more rigor, higher for more speed (tested with .5, .678, 1, 2, 3, and 4)
+ skip = 8; // lower for more rigor, higher for more speed (tested with .5, .678, 1, 2, 3, and 4)
searches = [
// x , y rad
@@ -25,7 +25,7 @@ function test(index) {
var bulk = t.initializeUnorderedBulkOp();
for ( x=-179; x<=179; x += skip ){
for ( y=-89; y<=89; y += skip ){
- o = { _id : num++ , loc : [ x , y ] }
+ o = { _id : num++ , loc : [ x , y ] };
bulk.insert( o );
for ( i=0; i<searches.length; i++ ){
if ( Geo.sphereDistance( [ x , y ] , searches[i][0] ) <= searches[i][1])
@@ -42,8 +42,8 @@ function test(index) {
for ( i=0; i<searches.length; i++ ){
print('------------');
- print( tojson( searches[i] ) + "\t" + correct[i].length )
- q = { loc : { $within : { $centerSphere : searches[i] } } }
+ print( tojson( searches[i] ) + "\t" + correct[i].length );
+ q = { loc : { $within : { $centerSphere : searches[i] } } };
//correct[i].forEach( printjson )
//printjson( q );
@@ -54,9 +54,9 @@ function test(index) {
//printjson( Array.sort( correct[i].map( function(z){ return z._id; } ) ) )
//printjson( Array.sort( t.find(q).map( function(z){ return z._id; } ) ) )
- var numExpected = correct[i].length
- var x = correct[i].map( function(z){ return z._id; } )
- var y = t.find(q).map( function(z){ return z._id; } )
+ var numExpected = correct[i].length;
+ var x = correct[i].map( function(z){ return z._id; } );
+ var y = t.find(q).map( function(z){ return z._id; } );
missing = [];
epsilon = 0.001; // allow tenth of a percent error due to conversions
@@ -65,7 +65,7 @@ function test(index) {
missing.push(x[j]);
var obj = t.findOne({_id: x[j]});
var dist = Geo.sphereDistance(searches[i][0], obj.loc);
- print("missing: " + tojson(obj) + " " + dist)
+ print("missing: " + tojson(obj) + " " + dist);
if ((Math.abs(dist - searches[i][1]) / dist) < epsilon)
numExpected -= 1;
}
@@ -75,7 +75,7 @@ function test(index) {
missing.push(y[j]);
var obj = t.findOne({_id: y[j]});
var dist = Geo.sphereDistance(searches[i][0], obj.loc);
- print("extra: " + tojson(obj) + " " + dist)
+ print("extra: " + tojson(obj) + " " + dist);
if ((Math.abs(dist - searches[i][1]) / dist) < epsilon)
numExpected += 1;
}
@@ -90,11 +90,11 @@ function test(index) {
// The index should be at least minimally effective in preventing the full collection
// scan.
assert.gt( t.find().count(), explain.executionStats.totalKeysExamined ,
- "nscanned : " + tojson( searches[i] ) )
+ "nscanned : " + tojson( searches[i] ) );
}
}
}
-test("2d")
-test("2dsphere")
-test(false)
+test("2d");
+test("2dsphere");
+test(false);
diff --git a/jstests/core/geo_center_sphere2.js b/jstests/core/geo_center_sphere2.js
index 0a551474beb..a569c4d5c96 100644
--- a/jstests/core/geo_center_sphere2.js
+++ b/jstests/core/geo_center_sphere2.js
@@ -48,7 +48,7 @@ for ( var test = 0; test < numTests; test++ ) {
t.drop();
startPoint = randomPoint();
t.ensureIndex( { loc : "2d" }, { bits : bits } );
- } while (!pointIsOK(startPoint, radius))
+ } while (!pointIsOK(startPoint, radius));
var pointsIn = 0;
var pointsOut = 0;
@@ -139,7 +139,7 @@ for ( var test = 0; test < numTests; test++ ) {
var distance = 0;
for ( var i = 0; i < results.length; i++ ) {
- var retDistance = results[i].dis
+ var retDistance = results[i].dis;
// print( "Dist from : " + results[i].loc + " to " + startPoint + " is "
// + retDistance + " vs " + radius )
diff --git a/jstests/core/geo_circle1.js b/jstests/core/geo_circle1.js
index 55cbbcc7e5c..c4b79e645ab 100644
--- a/jstests/core/geo_circle1.js
+++ b/jstests/core/geo_circle1.js
@@ -14,8 +14,8 @@ num = 0;
for ( x=0; x<=20; x++ ){
for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ o = { _id : num++ , loc : [ x , y ] };
+ t.save( o );
for ( i=0; i<searches.length; i++ )
if ( Geo.distance( [ x , y ] , searches[i][0] ) <= searches[i][1] )
correct[i].push( o );
@@ -26,7 +26,7 @@ t.ensureIndex( { loc : "2d" } );
for ( i=0; i<searches.length; i++ ){
//print( tojson( searches[i] ) + "\t" + correct[i].length )
- q = { loc : { $within : { $center : searches[i] } } }
+ q = { loc : { $within : { $center : searches[i] } } };
//correct[i].forEach( printjson )
//printjson( q );
diff --git a/jstests/core/geo_circle1_noindex.js b/jstests/core/geo_circle1_noindex.js
index 1569174a679..304f1404b64 100644
--- a/jstests/core/geo_circle1_noindex.js
+++ b/jstests/core/geo_circle1_noindex.js
@@ -14,8 +14,8 @@ num = 0;
for ( x=0; x<=20; x++ ){
for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ o = { _id : num++ , loc : [ x , y ] };
+ t.save( o );
for ( i=0; i<searches.length; i++ )
if ( Geo.distance( [ x , y ] , searches[i][0] ) <= searches[i][1] )
correct[i].push( o );
@@ -23,7 +23,7 @@ for ( x=0; x<=20; x++ ){
}
for ( i=0; i<searches.length; i++ ){
- q = { loc : { $within : { $center : searches[i] } } }
+ q = { loc : { $within : { $center : searches[i] } } };
assert.eq( correct[i].length , t.find( q ).itcount() , "itcount : " + tojson( searches[i] ) );
assert.eq( correct[i].length , t.find( q ).count() , "count : " + tojson( searches[i] ) );
}
diff --git a/jstests/core/geo_circle2.js b/jstests/core/geo_circle2.js
index ef76884609c..9a3b3c94860 100644
--- a/jstests/core/geo_circle2.js
+++ b/jstests/core/geo_circle2.js
@@ -23,4 +23,4 @@ assert.eq( 10 , t.find({ "loc" : { "$within" : { "$center" : [ { "x" : 0 ,"y" :
assert.eq( 6 , t.find({ "loc" : { "$within" : { "$center" : [ { "x" : 0 ,"y" : 0} , 50]}}, "categories" : "sports" } ).itcount() , "B" );
// When not a $near or $within query, geo index should not be used. Fails if geo index is used.
-assert.eq( 1 , t.find({ "loc" : { "x" : -36, "y" : -8}, "categories" : "sports" }).itcount(), "C" )
+assert.eq( 1 , t.find({ "loc" : { "x" : -36, "y" : -8}, "categories" : "sports" }).itcount(), "C" );
diff --git a/jstests/core/geo_circle2a.js b/jstests/core/geo_circle2a.js
index 67a6ba17243..e6d9d829782 100644
--- a/jstests/core/geo_circle2a.js
+++ b/jstests/core/geo_circle2a.js
@@ -4,34 +4,34 @@
var coll = db.geo_circle2a;
coll.drop();
-coll.insert({ p : [1112,3473], t : [{ k : 'a', v : 'b' }, { k : 'c', v : 'd' }] })
-coll.ensureIndex({ p : '2d', 't.k' : 1 }, { min : 0, max : 10000 })
+coll.insert({ p : [1112,3473], t : [{ k : 'a', v : 'b' }, { k : 'c', v : 'd' }] });
+coll.ensureIndex({ p : '2d', 't.k' : 1 }, { min : 0, max : 10000 });
// Succeeds, since on direct lookup should not use the index
-assert(1 == coll.find({p:[1112,3473],'t.k':'a'}).count(), "A")
+assert(1 == coll.find({p:[1112,3473],'t.k':'a'}).count(), "A");
// Succeeds and uses the geo index
-assert(1 == coll.find({p:{$within:{$box:[[1111,3472],[1113,3475]]}}, 't.k' : 'a' }).count(), "B")
+assert(1 == coll.find({p:{$within:{$box:[[1111,3472],[1113,3475]]}}, 't.k' : 'a' }).count(), "B");
-coll.drop()
-coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' }, { k : 'key2', v : 123 } ] })
-coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
+coll.drop();
+coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' }, { k : 'key2', v : 123 } ] });
+coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] });
-coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
+coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 });
// Succeeds, since should now lookup multi-keys correctly
-assert(2 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } } }).count(), "C")
+assert(2 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } } }).count(), "C");
// Succeeds, and should not use geoindex
-assert(2 == coll.find({ point : [1, 10] }).count(), "D")
-assert(2 == coll.find({ point : [1, 10], "tags.v" : "value" }).count(), "E")
-assert(1 == coll.find({ point : [1, 10], "tags.v" : 123 }).count(), "F")
+assert(2 == coll.find({ point : [1, 10] }).count(), "D");
+assert(2 == coll.find({ point : [1, 10], "tags.v" : "value" }).count(), "E");
+assert(1 == coll.find({ point : [1, 10], "tags.v" : 123 }).count(), "F");
-coll.drop()
-coll.insert({ point:[ 1, 10 ], tags : [ { k : { 'hello' : 'world'}, v : 'value' }, { k : 'key2', v : 123 } ] })
-coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
+coll.drop();
+coll.insert({ point:[ 1, 10 ], tags : [ { k : { 'hello' : 'world'}, v : 'value' }, { k : 'key2', v : 123 } ] });
+coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] });
-coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
+coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 });
// Succeeds, should be able to look up the complex element
-assert(1 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } }, 'tags.k' : { 'hello' : 'world' } }).count(), "G") \ No newline at end of file
+assert(1 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } }, 'tags.k' : { 'hello' : 'world' } }).count(), "G"); \ No newline at end of file
diff --git a/jstests/core/geo_circle3.js b/jstests/core/geo_circle3.js
index 2882b47378e..96907ce9706 100644
--- a/jstests/core/geo_circle3.js
+++ b/jstests/core/geo_circle3.js
@@ -1,19 +1,19 @@
// SERVER-848 and SERVER-1191.
-db.places.drop()
+db.places.drop();
n = 0;
-db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 52 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 52 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 52 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 52.0001 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 51.9999 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 52.0001 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 52.0001 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 51.9999 } })
-db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 51.9999 } })
-db.places.ensureIndex( { loc : "2d" } )
-radius=0.0001
-center=[5,52]
+db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 52 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 52 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 52 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 52.0001 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5, "y" : 51.9999 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 52.0001 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 52.0001 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 4.9999, "y" : 51.9999 } });
+db.places.save({ "_id": n++, "loc" : { "x" : 5.0001, "y" : 51.9999 } });
+db.places.ensureIndex( { loc : "2d" } );
+radius=0.0001;
+center=[5,52];
//print(db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}).count())
// FIXME: we want an assert, e.g., that there be 5 answers in the find().
db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}).forEach(printjson);
diff --git a/jstests/core/geo_circle4.js b/jstests/core/geo_circle4.js
index dc3c564389e..3113d54b38a 100644
--- a/jstests/core/geo_circle4.js
+++ b/jstests/core/geo_circle4.js
@@ -22,10 +22,10 @@ function test(index) {
// FIXME: surely code like this belongs in utils.js.
a=r.toArray();
x=[];
- for (k in a) { x.push(a[k]["_id"]) }
- x.sort()
+ for (k in a) { x.push(a[k]["_id"]); }
+ x.sort();
assert.eq([1,2,3,4,5], x, "B1");
}
-test(false)
-test(true)
+test(false);
+test(true);
diff --git a/jstests/core/geo_circle5.js b/jstests/core/geo_circle5.js
index fea9c56fd02..32b5744cea4 100644
--- a/jstests/core/geo_circle5.js
+++ b/jstests/core/geo_circle5.js
@@ -1,16 +1,16 @@
// reported as server-1238.
db.server1238.drop();
-db.server1238.remove({})
-db.server1238.save({ loc: [ 5000000, 900000 ], id: 1})
-db.server1238.save({ loc: [ 5000000, 900000 ], id: 2})
-db.server1238.ensureIndex( { loc : "2d" } , { min : -21000000 , max : 21000000 } )
-db.server1238.save({ loc: [ 5000000, 900000 ], id: 3})
-db.server1238.save({ loc: [ 5000000, 900000 ], id: 4})
+db.server1238.remove({});
+db.server1238.save({ loc: [ 5000000, 900000 ], id: 1});
+db.server1238.save({ loc: [ 5000000, 900000 ], id: 2});
+db.server1238.ensureIndex( { loc : "2d" } , { min : -21000000 , max : 21000000 } );
+db.server1238.save({ loc: [ 5000000, 900000 ], id: 3});
+db.server1238.save({ loc: [ 5000000, 900000 ], id: 4});
-c1=db.server1238.find({"loc" : {"$within" : {"$center" : [[5000000, 900000], 1.0]}}}).count()
+c1=db.server1238.find({"loc" : {"$within" : {"$center" : [[5000000, 900000], 1.0]}}}).count();
-c2=db.server1238.find({"loc" : {"$within" : {"$center" : [[5000001, 900000], 5.0]}}}).count()
+c2=db.server1238.find({"loc" : {"$within" : {"$center" : [[5000001, 900000], 5.0]}}}).count();
assert.eq(4, c1, "A1");
diff --git a/jstests/core/geo_exactfetch.js b/jstests/core/geo_exactfetch.js
index c0a0e714eae..43023897a4e 100644
--- a/jstests/core/geo_exactfetch.js
+++ b/jstests/core/geo_exactfetch.js
@@ -1,17 +1,17 @@
// SERVER-7322
-t = db.geo_exactfetch
+t = db.geo_exactfetch;
t.drop();
function test(indexname) {
assert.eq(1, t.find({lon_lat: [-71.34895, 42.46037]}).itcount(), indexname);
- t.ensureIndex({lon_lat: indexname, population: -1})
+ t.ensureIndex({lon_lat: indexname, population: -1});
assert.eq(2, t.find({lon_lat: {$nearSphere: [-71.34895, 42.46037]}}).itcount(), indexname);
assert.eq(1, t.find({lon_lat: [-71.34895, 42.46037]}).itcount(), indexname);
- t.dropIndex({lon_lat: indexname, population: -1})
+ t.dropIndex({lon_lat: indexname, population: -1});
}
-t.insert({ city: "B", lon_lat: [-71.34895, 42.46037], population: 1000})
-t.insert({ city: "A", lon_lat: [1.48736, 42.55327], population: 100})
+t.insert({ city: "B", lon_lat: [-71.34895, 42.46037], population: 1000});
+t.insert({ city: "A", lon_lat: [1.48736, 42.55327], population: 100});
-test("2d")
-test("2dsphere")
+test("2d");
+test("2dsphere");
diff --git a/jstests/core/geo_fiddly_box.js b/jstests/core/geo_fiddly_box.js
index 95f33a32987..cfda0a99757 100644
--- a/jstests/core/geo_fiddly_box.js
+++ b/jstests/core/geo_fiddly_box.js
@@ -4,38 +4,38 @@
// "expand" portion of the geo-lookup expands the 2d range in only one
// direction (so points are required on either side of the expanding range)
-t = db.geo_fiddly_box
+t = db.geo_fiddly_box;
t.drop();
-t.ensureIndex({ loc : "2d" })
+t.ensureIndex({ loc : "2d" });
-t.insert({ "loc" : [3, 1] })
-t.insert({ "loc" : [3, 0.5] })
-t.insert({ "loc" : [3, 0.25] })
-t.insert({ "loc" : [3, -0.01] })
-t.insert({ "loc" : [3, -0.25] })
-t.insert({ "loc" : [3, -0.5] })
-t.insert({ "loc" : [3, -1] })
+t.insert({ "loc" : [3, 1] });
+t.insert({ "loc" : [3, 0.5] });
+t.insert({ "loc" : [3, 0.25] });
+t.insert({ "loc" : [3, -0.01] });
+t.insert({ "loc" : [3, -0.25] });
+t.insert({ "loc" : [3, -0.5] });
+t.insert({ "loc" : [3, -1] });
// OK!
-print( t.count() )
+print( t.count() );
assert.eq( 7, t.count({ "loc" : { "$within" : { "$box" : [ [2, -2], [46, 2] ] } } }), "Not all locations found!" );
// Test normal lookup of a small square of points as a sanity check.
epsilon = 0.0001;
-min = -1
-max = 1
-step = 1
+min = -1;
+max = 1;
+step = 1;
numItems = 0;
-t.drop()
-t.ensureIndex({ loc : "2d" }, { max : max + epsilon / 2, min : min - epsilon / 2 })
+t.drop();
+t.ensureIndex({ loc : "2d" }, { max : max + epsilon / 2, min : min - epsilon / 2 });
for(var x = min; x <= max; x += step){
for(var y = min; y <= max; y += step){
- t.insert({ "loc" : { x : x, y : y } })
+ t.insert({ "loc" : { x : x, y : y } });
numItems++;
}
}
diff --git a/jstests/core/geo_fiddly_box2.js b/jstests/core/geo_fiddly_box2.js
index 0588abfa1de..c0be0f2c8dc 100644
--- a/jstests/core/geo_fiddly_box2.js
+++ b/jstests/core/geo_fiddly_box2.js
@@ -3,30 +3,30 @@
// The setup to reproduce is to create a set of points and a really big bounds so that we are required to do
// exact lookups on the points to get correct results.
-t = db.geo_fiddly_box2
-t.drop()
+t = db.geo_fiddly_box2;
+t.drop();
-t.insert( { "letter" : "S", "position" : [ -3, 0 ] } )
-t.insert( { "letter" : "C", "position" : [ -2, 0 ] } )
-t.insert( { "letter" : "R", "position" : [ -1, 0 ] } )
-t.insert( { "letter" : "A", "position" : [ 0, 0 ] } )
-t.insert( { "letter" : "B", "position" : [ 1, 0 ] } )
-t.insert( { "letter" : "B", "position" : [ 2, 0 ] } )
-t.insert( { "letter" : "L", "position" : [ 3, 0 ] } )
-t.insert( { "letter" : "E", "position" : [ 4, 0 ] } )
+t.insert( { "letter" : "S", "position" : [ -3, 0 ] } );
+t.insert( { "letter" : "C", "position" : [ -2, 0 ] } );
+t.insert( { "letter" : "R", "position" : [ -1, 0 ] } );
+t.insert( { "letter" : "A", "position" : [ 0, 0 ] } );
+t.insert( { "letter" : "B", "position" : [ 1, 0 ] } );
+t.insert( { "letter" : "B", "position" : [ 2, 0 ] } );
+t.insert( { "letter" : "L", "position" : [ 3, 0 ] } );
+t.insert( { "letter" : "E", "position" : [ 4, 0 ] } );
-t.ensureIndex( { position : "2d" } )
-result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } )
-assert.eq( 4, result.count() )
+t.ensureIndex( { position : "2d" } );
+result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } );
+assert.eq( 4, result.count() );
-t.dropIndex( { position : "2d" } )
-t.ensureIndex( { position : "2d" }, { min : -10000000, max : 10000000 } )
+t.dropIndex( { position : "2d" } );
+t.ensureIndex( { position : "2d" }, { min : -10000000, max : 10000000 } );
-result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } )
-assert.eq( 4, result.count() )
+result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } );
+assert.eq( 4, result.count() );
-t.dropIndex( { position : "2d" } )
-t.ensureIndex( { position : "2d" }, { min : -1000000000, max : 1000000000 } )
+t.dropIndex( { position : "2d" } );
+t.ensureIndex( { position : "2d" }, { min : -1000000000, max : 1000000000 } );
-result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } )
-assert.eq( 4, result.count() )
+result = t.find( { "position" : { "$within" : { "$box" : [ [ -3, -1 ], [ 0, 1 ] ] } } } );
+assert.eq( 4, result.count() );
diff --git a/jstests/core/geo_group.js b/jstests/core/geo_group.js
index 32e06890568..b19c35ec738 100644
--- a/jstests/core/geo_group.js
+++ b/jstests/core/geo_group.js
@@ -20,7 +20,7 @@ assert.eq(t.find( { loc : { $near : [56, 8, 10] } } ).count(), 81);
// Test basic group that effectively does a count
assert.eq(
t.group( {
- reduce : function (obj, prev) { prev.sums = { count : prev.sums.count + 1} },
+ reduce : function (obj, prev) { prev.sums = { count : prev.sums.count + 1}; },
initial : { sums:{count:0} } }
),
[ { "sums" : { "count" : 10000 } } ]
@@ -29,7 +29,7 @@ assert.eq(
// Test basic group + $near that does a count
assert.eq(
t.group( {
- reduce : function (obj, prev) { prev.sums = { count : prev.sums.count + 1} },
+ reduce : function (obj, prev) { prev.sums = { count : prev.sums.count + 1}; },
initial : { sums:{count:0} },
cond : { loc : { $near : [56, 8, 10] } } }
),
diff --git a/jstests/core/geo_haystack1.js b/jstests/core/geo_haystack1.js
index f4035ecbcf2..f29f407c52e 100644
--- a/jstests/core/geo_haystack1.js
+++ b/jstests/core/geo_haystack1.js
@@ -1,6 +1,6 @@
-t = db.geo_haystack1
-t.drop()
+t = db.geo_haystack1;
+t.drop();
function distance( a , b ){
var x = a[0] - b[0];
@@ -18,9 +18,9 @@ function distanceTotal( a , arr , f ){
queries = [
{ near : [ 7 , 8 ] , maxDistance : 3 , search : { z : 3 } } ,
-]
+];
-answers = queries.map( function(){ return { totalDistance : 0 , results : [] }; } )
+answers = queries.map( function(){ return { totalDistance : 0 , results : [] }; } );
n = 0;
@@ -29,12 +29,12 @@ for ( x=0; x<20; x++ ){
t.insert( { _id : n , loc : [ x , y ] , z : n % 5 } );
for ( i=0; i<queries.length; i++ ){
- var d = distance( queries[i].near , [ x , y ] )
+ var d = distance( queries[i].near , [ x , y ] );
if ( d > queries[i].maxDistance )
continue;
if ( queries[i].search.z != n % 5 )
continue;
- answers[i].results.push( { _id : n , loc : [ x , y ]} )
+ answers[i].results.push( { _id : n , loc : [ x , y ]} );
answers[i].totalDistance += d;
}
@@ -47,11 +47,11 @@ t.ensureIndex( { loc : "geoHaystack" , z : 1 } , { bucketSize : .7 } );
for ( i=0; i<queries.length; i++ ){
print( "---------" );
printjson( queries[i] );
- res = t.runCommand( "geoSearch" , queries[i] )
+ res = t.runCommand( "geoSearch" , queries[i] );
print( "\t" + tojson( res.stats ) );
print( "\tshould have: " + answers[i].results.length + "\t actually got: " + res.stats.n );
- assert.eq( answers[i].results.length , res.stats.n, "num:"+ i + " number matches" )
- assert.eq( answers[i].totalDistance , distanceTotal( queries[i].near , res.results , "loc" ), "num:"+ i + " totalDistance" )
+ assert.eq( answers[i].results.length , res.stats.n, "num:"+ i + " number matches" );
+ assert.eq( answers[i].totalDistance , distanceTotal( queries[i].near , res.results , "loc" ), "num:"+ i + " totalDistance" );
//printjson( res );
//printjson( answers[i].length );
}
diff --git a/jstests/core/geo_haystack2.js b/jstests/core/geo_haystack2.js
index 2e0eb5710fb..dee935b9b2b 100644
--- a/jstests/core/geo_haystack2.js
+++ b/jstests/core/geo_haystack2.js
@@ -1,6 +1,6 @@
-t = db.geo_haystack2
-t.drop()
+t = db.geo_haystack2;
+t.drop();
function distance( a , b ){
var x = a[0] - b[0];
@@ -18,9 +18,9 @@ function distanceTotal( a , arr , f ){
queries = [
{ near : [ 7 , 8 ] , maxDistance : 3 , search : { z : 3 } } ,
-]
+];
-answers = queries.map( function(){ return { totalDistance : 0 , results : [] }; } )
+answers = queries.map( function(){ return { totalDistance : 0 , results : [] }; } );
n = 0;
@@ -29,13 +29,13 @@ for ( x=0; x<20; x++ ){
t.insert( { _id : n , loc : [ x , y ] , z : [ n % 10 , ( n + 5 ) % 10 ] } );
for ( i=0; i<queries.length; i++ ){
- var d = distance( queries[i].near , [ x , y ] )
+ var d = distance( queries[i].near , [ x , y ] );
if ( d > queries[i].maxDistance )
continue;
if ( queries[i].search.z != n % 10 &&
queries[i].search.z != ( n + 5 ) % 10 )
continue;
- answers[i].results.push( { _id : n , loc : [ x , y ] } )
+ answers[i].results.push( { _id : n , loc : [ x , y ] } );
answers[i].totalDistance += d;
}
@@ -48,11 +48,11 @@ t.ensureIndex( { loc : "geoHaystack" , z : 1 } , { bucketSize : .7 } );
for ( i=0; i<queries.length; i++ ){
print( "---------" );
printjson( queries[i] );
- res = t.runCommand( "geoSearch" , queries[i] )
+ res = t.runCommand( "geoSearch" , queries[i] );
print( "\t" + tojson( res.stats ) );
print( "\tshould have: " + answers[i].results.length + "\t actually got: " + res.stats.n );
- assert.eq( answers[i].results.length , res.stats.n, "num:"+ i + " number matches" )
- assert.eq( answers[i].totalDistance , distanceTotal( queries[i].near , res.results , "loc" ), "num:"+ i + " totalDistance" )
+ assert.eq( answers[i].results.length , res.stats.n, "num:"+ i + " number matches" );
+ assert.eq( answers[i].totalDistance , distanceTotal( queries[i].near , res.results , "loc" ), "num:"+ i + " totalDistance" );
//printjson( res );
//printjson( answers[i].length );
}
diff --git a/jstests/core/geo_haystack3.js b/jstests/core/geo_haystack3.js
index 537151ee8a1..4c55e94ad7f 100644
--- a/jstests/core/geo_haystack3.js
+++ b/jstests/core/geo_haystack3.js
@@ -1,5 +1,5 @@
-t = db.geo_haystack3
-t.drop()
+t = db.geo_haystack3;
+t.drop();
//
// Tests for geo haystack validity
@@ -29,21 +29,21 @@ t.drop();
// Tests for geo haystack search
//
-t.insert({ pos : { long : 34, lat : 33 }})
-t.insert({ pos : { long : 34.2, lat : 33.3 }, type : ["bar", "restaurant" ]})
-t.insert({ pos : { long : 34.2, lat : 37.3 }, type : ["bar", "chicken" ]})
-t.insert({ pos : { long : 59.1, lat : 87.2 }, type : ["baz", "office" ]})
-t.ensureIndex({ pos : "geoHaystack", type : 1 }, { bucketSize : 1 })
+t.insert({ pos : { long : 34, lat : 33 }});
+t.insert({ pos : { long : 34.2, lat : 33.3 }, type : ["bar", "restaurant" ]});
+t.insert({ pos : { long : 34.2, lat : 37.3 }, type : ["bar", "chicken" ]});
+t.insert({ pos : { long : 59.1, lat : 87.2 }, type : ["baz", "office" ]});
+t.ensureIndex({ pos : "geoHaystack", type : 1 }, { bucketSize : 1 });
// This only matches the first insert. What do we want? First 3 or just the first?
-res = t.runCommand("geoSearch", { near : [33, 33], maxDistance : 6, search : {}, limit : 30 })
+res = t.runCommand("geoSearch", { near : [33, 33], maxDistance : 6, search : {}, limit : 30 });
assert.eq(1, res.stats.n, "Right # of matches");
assert.eq(34, res.results[0].pos.long, "expected longitude");
assert.eq(33, res.results[0].pos.lat, "expected latitude");
// This matches the middle 2 of the 4 elements above.
res = t.runCommand("geoSearch", { near : [33, 33], maxDistance : 6, search : { type : "bar" },
- limit : 2 })
+ limit : 2 });
assert.eq(2, res.stats.n, "Right # of matches");
assert.eq("bar", res.results[0].type[0], "expected value for type");
assert.eq("bar", res.results[1].type[0], "expected value for type");
@@ -51,6 +51,6 @@ assert.neq(res.results[0].type[1], res.results[1].type[1], "should get 2 diff re
// This is a test for the limit being reached/only 1 returned.
res = t.runCommand("geoSearch", { near : [33, 33], maxDistance : 6, search : { type : "bar" },
- limit : 1 })
+ limit : 1 });
assert.eq(1, res.stats.n, "Right # of matches");
assert.eq("bar", res.results[0].type[0], "expected value for type");
diff --git a/jstests/core/geo_mapreduce.js b/jstests/core/geo_mapreduce.js
index a6ecf763ae1..810c2605426 100644
--- a/jstests/core/geo_mapreduce.js
+++ b/jstests/core/geo_mapreduce.js
@@ -3,7 +3,7 @@
// MongoDB test script for mapreduce with geo query
// setup test collection
-db.apples.drop()
+db.apples.drop();
db.apples.insert( { "geo" : { "lat" : 32.68331909, "long" : 69.41610718 }, "apples" : 5 } );
db.apples.insert( { "geo" : { "lat" : 35.01860809, "long" : 70.92027283 }, "apples" : 2 } );
db.apples.insert( { "geo" : { "lat" : 31.11639023, "long" : 64.19970703 }, "apples" : 11 } );
@@ -36,7 +36,7 @@ r = function(key, values) {
// mapreduce without geo query works fine
res = db.apples.mapReduce( m, r, { out : { inline : 1 } } );
-printjson( res )
+printjson( res );
total = res.results[0];
assert.eq( 31, total.value.apples );
diff --git a/jstests/core/geo_mapreduce2.js b/jstests/core/geo_mapreduce2.js
index 9c393457c7b..3911d02cf81 100644
--- a/jstests/core/geo_mapreduce2.js
+++ b/jstests/core/geo_mapreduce2.js
@@ -1,36 +1,36 @@
// Geo mapreduce 2 from SERVER-3478
-var coll = db.geoMR2
-coll.drop()
+var coll = db.geoMR2;
+coll.drop();
for( var i = 0; i < 300; i++ )
- coll.insert({ i : i, location : [ 10, 20 ] })
+ coll.insert({ i : i, location : [ 10, 20 ] });
-coll.ensureIndex({ location : "2d" })
+coll.ensureIndex({ location : "2d" });
// map function
m = function() {
- emit( null, { count : this.i } )
-}
+ emit( null, { count : this.i } );
+};
// reduce function
r = function( key, values ) {
- var total = 0
+ var total = 0;
for ( var i = 0; i < values.length; i++ ) {
- total += values[i].count
+ total += values[i].count;
}
- return { count : total }
+ return { count : total };
};
try{ coll.mapReduce( m, r,
{ out : coll.getName() + "_mr",
sort : { _id : 1 },
- query : { 'location' : { $within : { $centerSphere : [[ 10, 20 ], 0.01 ] } } } })
+ query : { 'location' : { $within : { $centerSphere : [[ 10, 20 ], 0.01 ] } } } });
}
catch( e ){
// This should occur, since we can't in-mem sort for mreduce
- printjson( e )
+ printjson( e );
}
diff --git a/jstests/core/geo_max.js b/jstests/core/geo_max.js
index 70fde0c35ec..1dcbf39c907 100644
--- a/jstests/core/geo_max.js
+++ b/jstests/core/geo_max.js
@@ -3,49 +3,49 @@
// If there aren't enough points the test passes even if the code is broken.
load("jstests/libs/geo_near_random.js");
-var test = new GeoNearRandomTest("geo_near_max")
+var test = new GeoNearRandomTest("geo_near_max");
test.insertPts(/*numPts*/1000, /*indexBounds*/{min:-180, max:180}, /*scale*/0.9);
-test.t.insert({loc: [ 180, 0]})
-test.t.insert({loc: [-180, 0]})
-test.t.insert({loc: [ 179.999, 0]})
-test.t.insert({loc: [-179.999, 0]})
+test.t.insert({loc: [ 180, 0]});
+test.t.insert({loc: [-180, 0]});
+test.t.insert({loc: [ 179.999, 0]});
+test.t.insert({loc: [-179.999, 0]});
-assertXIsNegative = function(obj) { assert.lt(obj.loc[0], 0); }
-assertXIsPositive = function(obj) { assert.gt(obj.loc[0], 0); }
+assertXIsNegative = function(obj) { assert.lt(obj.loc[0], 0); };
+assertXIsPositive = function(obj) { assert.gt(obj.loc[0], 0); };
-assert.eq(test.t.count({loc:{$within: {$center:[[ 180, 0], 1]}}}), 2)
-assert.eq(test.t.count({loc:{$within: {$center:[[-180, 0], 1]}}}), 2)
-test.t.find({loc:{$within: {$center:[[ 180, 0], 1]}}}).forEach(assertXIsPositive)
-test.t.find({loc:{$within: {$center:[[-180, 0], 1]}}}).forEach(assertXIsNegative)
+assert.eq(test.t.count({loc:{$within: {$center:[[ 180, 0], 1]}}}), 2);
+assert.eq(test.t.count({loc:{$within: {$center:[[-180, 0], 1]}}}), 2);
+test.t.find({loc:{$within: {$center:[[ 180, 0], 1]}}}).forEach(assertXIsPositive);
+test.t.find({loc:{$within: {$center:[[-180, 0], 1]}}}).forEach(assertXIsNegative);
var oneDegree = Math.PI / 180; // in radians
// errors out due to SERVER-1760
if (0) {
-assert.eq(test.t.count({loc:{$within: {$centerSphere:[[ 180, 0], oneDegree]}}}), 2)
-assert.eq(test.t.count({loc:{$within: {$centerSphere:[[-180, 0], oneDegree]}}}), 2)
-test.t.find({loc:{$within: {$centerSphere:[[ 180, 0], oneDegree]}}}).forEach(assertXIsPositive)
-test.t.find({loc:{$within: {$centerSphere:[[-180, 0], oneDegree]}}}).forEach(assertXIsNegative)
+assert.eq(test.t.count({loc:{$within: {$centerSphere:[[ 180, 0], oneDegree]}}}), 2);
+assert.eq(test.t.count({loc:{$within: {$centerSphere:[[-180, 0], oneDegree]}}}), 2);
+test.t.find({loc:{$within: {$centerSphere:[[ 180, 0], oneDegree]}}}).forEach(assertXIsPositive);
+test.t.find({loc:{$within: {$centerSphere:[[-180, 0], oneDegree]}}}).forEach(assertXIsNegative);
}
-assert.eq(test.t.count({loc:{$within: {$box:[[ 180, 0.1], [ 179, -0.1]]}}}), 2)
-assert.eq(test.t.count({loc:{$within: {$box:[[-180, 0.1], [-179, -0.1]]}}}), 2)
-test.t.find({loc:{$within: {$box:[[ 180, 0.1], [ 179, -0.1]]}}}).forEach(assertXIsPositive)
-test.t.find({loc:{$within: {$box:[[-180, 0.1], [-179, -0.1]]}}}).forEach(assertXIsNegative)
+assert.eq(test.t.count({loc:{$within: {$box:[[ 180, 0.1], [ 179, -0.1]]}}}), 2);
+assert.eq(test.t.count({loc:{$within: {$box:[[-180, 0.1], [-179, -0.1]]}}}), 2);
+test.t.find({loc:{$within: {$box:[[ 180, 0.1], [ 179, -0.1]]}}}).forEach(assertXIsPositive);
+test.t.find({loc:{$within: {$box:[[-180, 0.1], [-179, -0.1]]}}}).forEach(assertXIsNegative);
-assert.eq(test.t.count({loc:{$within: {$polygon:[[ 180, 0], [ 179, 0], [ 179.5, 0.5]]}}}), 2)
-assert.eq(test.t.count({loc:{$within: {$polygon:[[-180, 0], [-179, 0], [ 179.5, 0.5]]}}}), 2)
-test.t.find({loc:{$within: {$polygon:[[ 180, 0], [ 179, 0], [ 179.5, 0.5]]}}}).forEach(assertXIsPositive)
-test.t.find({loc:{$within: {$polygon:[[-180, 0], [-179, 0], [ 179.5, 0.5]]}}}).forEach(assertXIsNegative)
+assert.eq(test.t.count({loc:{$within: {$polygon:[[ 180, 0], [ 179, 0], [ 179.5, 0.5]]}}}), 2);
+assert.eq(test.t.count({loc:{$within: {$polygon:[[-180, 0], [-179, 0], [ 179.5, 0.5]]}}}), 2);
+test.t.find({loc:{$within: {$polygon:[[ 180, 0], [ 179, 0], [ 179.5, 0.5]]}}}).forEach(assertXIsPositive);
+test.t.find({loc:{$within: {$polygon:[[-180, 0], [-179, 0], [ 179.5, 0.5]]}}}).forEach(assertXIsNegative);
-assert.eq(test.t.find({loc:{$near:[ 180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [ 180, 0]}, {loc: [ 179.999, 0]}])
-assert.eq(test.t.find({loc:{$near:[-180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [-180, 0]}, {loc: [-179.999, 0]}])
+assert.eq(test.t.find({loc:{$near:[ 180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [ 180, 0]}, {loc: [ 179.999, 0]}]);
+assert.eq(test.t.find({loc:{$near:[-180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [-180, 0]}, {loc: [-179.999, 0]}]);
// These will need to change when SERVER-1760 is fixed
printjson(test.t.find({loc:{$nearSphere:[ 180, 0]}}, {_id:0}).limit(2).explain());
-assert.eq(test.t.find({loc:{$nearSphere:[ 180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [ 180, 0]}, {loc: [ 179.999, 0]}])
+assert.eq(test.t.find({loc:{$nearSphere:[ 180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [ 180, 0]}, {loc: [ 179.999, 0]}]);
printjson(test.t.find({loc:{$nearSphere:[-180, 0]}}, {_id:0}).limit(2).explain());
-assert.eq(test.t.find({loc:{$nearSphere:[-180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [-180, 0]}, {loc: [-179.999, 0]}])
+assert.eq(test.t.find({loc:{$nearSphere:[-180, 0]}}, {_id:0}).limit(2).toArray(), [{loc: [-180, 0]}, {loc: [-179.999, 0]}]);
diff --git a/jstests/core/geo_multinest0.js b/jstests/core/geo_multinest0.js
index 7cde4f87280..c3f6fa5c29e 100644
--- a/jstests/core/geo_multinest0.js
+++ b/jstests/core/geo_multinest0.js
@@ -1,18 +1,18 @@
// Make sure nesting of location arrays also works.
-t = db.geonest
+t = db.geonest;
t.drop();
t.insert( { zip : "10001", data : [ { loc : [ 10, 10 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
+ { loc : [ 50, 50 ], type : "work" } ] } );
t.insert( { zip : "10002", data : [ { loc : [ 20, 20 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
+ { loc : [ 50, 50 ], type : "work" } ] } );
var res = t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
{ loc : [ 50, 50 ], type : "work" } ] } );
assert.writeOK( res );
assert.commandWorked(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
-assert.eq( 2, t.getIndexKeys().length )
+assert.eq( 2, t.getIndexKeys().length );
res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
{ loc : [ 50, 50 ], type : "work" } ] } );
@@ -20,7 +20,7 @@ assert.writeOK( res );
// test normal access
-printjson( t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() )
+printjson( t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() );
assert.eq( 4, t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).count() );
@@ -32,17 +32,17 @@ assert.eq( 4, t.find( { "data.loc" : { $within : { $box : [ [ 45, 45 ], [ 50, 50
// Try a complex nesting
-t = db.geonest
+t = db.geonest;
t.drop();
-t.insert( { zip : "10001", data : [ { loc : [ [ 10, 10 ], { lat : 50, long : 50 } ], type : "home" } ] } )
+t.insert( { zip : "10001", data : [ { loc : [ [ 10, 10 ], { lat : 50, long : 50 } ], type : "home" } ] } );
t.insert( { zip : "10002", data : [ { loc : [ 20, 20 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
+ { loc : [ 50, 50 ], type : "work" } ] } );
res = t.insert({ zip: "10003", data: [{ loc: [{ x: 30, y: 30 }, [ 50, 50 ]], type: "home" }]});
assert( !res.hasWriteError() );
assert.commandWorked(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
-assert.eq( 2, t.getIndexKeys().length )
+assert.eq( 2, t.getIndexKeys().length );
res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
{ loc : [ 50, 50 ], type : "work" } ] } );
@@ -50,7 +50,7 @@ res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
assert.writeOK( res );
// test normal access
-printjson( t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() )
+printjson( t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() );
assert.eq( 4, t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).count() );
diff --git a/jstests/core/geo_multinest1.js b/jstests/core/geo_multinest1.js
index 9d63e72eb79..f93138e1fd0 100644
--- a/jstests/core/geo_multinest1.js
+++ b/jstests/core/geo_multinest1.js
@@ -1,18 +1,18 @@
// Test distance queries with interleaved distances
-t = db.multinest
+t = db.multinest;
t.drop();
t.insert( { zip : "10001", data : [ { loc : [ 10, 10 ], type : "home" },
- { loc : [ 29, 29 ], type : "work" } ] } )
+ { loc : [ 29, 29 ], type : "work" } ] } );
t.insert( { zip : "10002", data : [ { loc : [ 20, 20 ], type : "home" },
- { loc : [ 39, 39 ], type : "work" } ] } )
+ { loc : [ 39, 39 ], type : "work" } ] } );
var res = t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
{ loc : [ 49, 49 ], type : "work" } ] } );
assert.writeOK( res );
assert.commandWorked(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
-assert.eq( 2, t.getIndexKeys().length )
+assert.eq( 2, t.getIndexKeys().length );
res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
{ loc : [ 59, 59 ], type : "work" } ] } );
@@ -22,14 +22,14 @@ assert.writeOK( res );
var result = t.find({ "data.loc" : { $near : [0, 0] } }).toArray();
-printjson( result )
+printjson( result );
-assert.eq( 4, result.length )
+assert.eq( 4, result.length );
-var order = [ 1, 2, 3, 4 ]
+var order = [ 1, 2, 3, 4 ];
for( var i = 0; i < result.length; i++ ){
- assert.eq( "1000" + order[i], result[i].zip )
+ assert.eq( "1000" + order[i], result[i].zip );
}
diff --git a/jstests/core/geo_near_random2.js b/jstests/core/geo_near_random2.js
index d8487df5a07..af48c9d072e 100644
--- a/jstests/core/geo_near_random2.js
+++ b/jstests/core/geo_near_random2.js
@@ -19,7 +19,7 @@ test.testPt(test.mkPt(), opts);
test.testPt(test.mkPt(), opts);
test.testPt(test.mkPt(), opts);
-opts.sphere = 1
+opts.sphere = 1;
// Test $nearSphere with 2d index
test.testPt([0,0], opts);
diff --git a/jstests/core/geo_nearwithin.js b/jstests/core/geo_nearwithin.js
index 6f38f5dd7d9..2b0462ebe3d 100644
--- a/jstests/core/geo_nearwithin.js
+++ b/jstests/core/geo_nearwithin.js
@@ -1,27 +1,27 @@
// Test geoNear + $within.
-t = db.geo_nearwithin
+t = db.geo_nearwithin;
t.drop();
-points = 10
+points = 10;
for (var x = -points; x < points; x += 1) {
for (var y = -points; y < points; y += 1) {
- t.insert({geo: [x, y]})
+ t.insert({geo: [x, y]});
}
}
-t.ensureIndex({ geo : "2d" })
+t.ensureIndex({ geo : "2d" });
-resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[0, 0], 1]}}}})
-assert.eq(resNear.results.length, 5)
-resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[0, 0], 0]}}}})
-assert.eq(resNear.results.length, 1)
-resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[1, 0], 0.5]}}}})
-assert.eq(resNear.results.length, 1)
-resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[1, 0], 1.5]}}}})
-assert.eq(resNear.results.length, 9)
+resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[0, 0], 1]}}}});
+assert.eq(resNear.results.length, 5);
+resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[0, 0], 0]}}}});
+assert.eq(resNear.results.length, 1);
+resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[1, 0], 0.5]}}}});
+assert.eq(resNear.results.length, 1);
+resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {geo: {$within: {$center: [[1, 0], 1.5]}}}});
+assert.eq(resNear.results.length, 9);
// We want everything distance >1 from us but <1.5
// These points are (-+1, -+1)
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], query: {$and: [{geo: {$within: {$center: [[0, 0], 1.5]}}},
- {geo: {$not: {$within: {$center: [[0,0], 1]}}}}]}})
-assert.eq(resNear.results.length, 4)
+ {geo: {$not: {$within: {$center: [[0,0], 1]}}}}]}});
+assert.eq(resNear.results.length, 4);
diff --git a/jstests/core/geo_oob_sphere.js b/jstests/core/geo_oob_sphere.js
index e03111bcf16..7403cc99610 100644
--- a/jstests/core/geo_oob_sphere.js
+++ b/jstests/core/geo_oob_sphere.js
@@ -2,30 +2,30 @@
// Ensures spherical queries report invalid latitude values in points and center positions
//
-t = db.geooobsphere
+t = db.geooobsphere;
t.drop();
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 89 } })
-t.insert({ loc : { x : 30, y : 91 } })
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 89 } });
+t.insert({ loc : { x : 30, y : 91 } });
-assert.commandWorked(t.ensureIndex({ loc : "2d" }))
+assert.commandWorked(t.ensureIndex({ loc : "2d" }));
-assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count() } );
+assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count(); } );
// TODO: SERVER-9986 - it's not clear that throwing is correct behavior here
// assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 89 ], $maxDistance : 0.25 } }).count() } );
-assert.throws( function() { t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count() } );
+assert.throws( function() { t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count(); } );
var res;
-res = db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true })
-assert.commandFailed( res )
-printjson( res )
+res = db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true });
+assert.commandFailed( res );
+printjson( res );
// TODO: SERVER-9986 - it's not clear that throwing is correct behavior here
// res = db.runCommand({ geoNear : "geooobsphere", near : [30, 89], maxDistance : 0.25, spherical : true })
diff --git a/jstests/core/geo_or.js b/jstests/core/geo_or.js
index fd9b7234a21..17c7340faff 100644
--- a/jstests/core/geo_or.js
+++ b/jstests/core/geo_or.js
@@ -12,7 +12,7 @@ t.save({loc: q});
var indexname = "2dsphere";
-t.ensureIndex({loc: indexname})
+t.ensureIndex({loc: indexname});
assert.eq(1, t.find({loc: p}).itcount(), indexname);
@@ -55,7 +55,7 @@ t.dropIndexes();
var indexname = "2d";
-t.ensureIndex({loc: indexname})
+t.ensureIndex({loc: indexname});
assert.eq(2, t.find({$or: [{loc: {$geoWithin: {$centerSphere: [p, 10]}}},
{loc: {$geoWithin: {$centerSphere: [p, 10]}}}]}).itcount(),
diff --git a/jstests/core/geo_poly_edge.js b/jstests/core/geo_poly_edge.js
index 31a0849e67d..ce93607f1d3 100644
--- a/jstests/core/geo_poly_edge.js
+++ b/jstests/core/geo_poly_edge.js
@@ -2,21 +2,21 @@
// Tests polygon edge cases
//
-var coll = db.getCollection( 'jstests_geo_poly_edge' )
+var coll = db.getCollection( 'jstests_geo_poly_edge' );
coll.drop();
-coll.ensureIndex({ loc : "2d" })
+coll.ensureIndex({ loc : "2d" });
-coll.insert({ loc : [10, 10] })
-coll.insert({ loc : [10, -10] })
+coll.insert({ loc : [10, 10] });
+coll.insert({ loc : [10, -10] });
-assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, -10 ]] } } }).itcount(), 2 )
+assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, -10 ]] } } }).itcount(), 2 );
-assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, 10 ]] } } }).itcount(), 1 )
+assert.eq( coll.find({ loc : { $within : { $polygon : [[ 10, 10 ], [ 10, 10 ], [ 10, 10 ]] } } }).itcount(), 1 );
-coll.insert({ loc : [179, 0] })
-coll.insert({ loc : [0, 179] })
+coll.insert({ loc : [179, 0] });
+coll.insert({ loc : [0, 179] });
-assert.eq( coll.find({ loc : { $within : { $polygon : [[0, 0], [1000, 0], [1000, 1000], [0, 1000]] } } }).itcount(), 3 )
+assert.eq( coll.find({ loc : { $within : { $polygon : [[0, 0], [1000, 0], [1000, 1000], [0, 1000]] } } }).itcount(), 3 );
diff --git a/jstests/core/geo_poly_line.js b/jstests/core/geo_poly_line.js
index aca77b6ab0a..2b61d464b05 100644
--- a/jstests/core/geo_poly_line.js
+++ b/jstests/core/geo_poly_line.js
@@ -3,15 +3,15 @@
t = db.geo_polygon5;
t.drop();
-t.insert({loc:[0,0]})
-t.insert({loc:[1,0]})
-t.insert({loc:[2,0]})
-t.insert({loc:[3,0]})
-t.insert({loc:[4,0]})
+t.insert({loc:[0,0]});
+t.insert({loc:[1,0]});
+t.insert({loc:[2,0]});
+t.insert({loc:[3,0]});
+t.insert({loc:[4,0]});
t.ensureIndex( { loc : "2d" } );
-printjson( t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).toArray() )
+printjson( t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).toArray() );
-assert.eq( 5, t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).itcount() )
+assert.eq( 5, t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).itcount() );
diff --git a/jstests/core/geo_polygon1.js b/jstests/core/geo_polygon1.js
index 7af6d06bebd..de2652e69bc 100644
--- a/jstests/core/geo_polygon1.js
+++ b/jstests/core/geo_polygon1.js
@@ -25,7 +25,7 @@ boxBounds = [ [0,0], [0,10], [10,10], [10,0] ];
assert.eq( num , t.find( { loc : { "$within" : { "$polygon" : boxBounds } } } ).count() , "Bounding Box Test" );
//Make sure we can add object-based polygons
-assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() )
+assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() );
// Look in a box much bigger than the one we have data in
boxBounds = [[-100,-100], [-100, 100], [100,100], [100,-100]];
@@ -44,30 +44,30 @@ assert.commandWorked(t.ensureIndex( { loc : "2d" } ));
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman single point" );
-t.save({ loc : [5, 3] }) // Add a point that's out right in the mouth opening
-t.save({ loc : [3, 7] }) // Add a point above the center of the head
-t.save({ loc : [3,-1] }) // Add a point below the center of the bottom
+t.save({ loc : [5, 3] }); // Add a point that's out right in the mouth opening
+t.save({ loc : [3, 7] }); // Add a point above the center of the head
+t.save({ loc : [3,-1] }); // Add a point below the center of the bottom
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman double point" );
// Make sure we can't add bad polygons
-okay = true
+okay = true;
try{
- t.find( { loc : { $within : { $polygon : [1, 2] } } } ).toArray()
- okay = false
+ t.find( { loc : { $within : { $polygon : [1, 2] } } } ).toArray();
+ okay = false;
}
catch(e){}
-assert(okay)
+assert(okay);
try{
- t.find( { loc : { $within : { $polygon : [[1, 2]] } } } ).toArray()
- okay = false
+ t.find( { loc : { $within : { $polygon : [[1, 2]] } } } ).toArray();
+ okay = false;
}
catch(e){}
-assert(okay)
+assert(okay);
try{
- t.find( { loc : { $within : { $polygon : [[1, 2], [2, 3]] } } } ).toArray()
- okay = false
+ t.find( { loc : { $within : { $polygon : [[1, 2], [2, 3]] } } } ).toArray();
+ okay = false;
}
catch(e){}
-assert(okay)
+assert(okay);
diff --git a/jstests/core/geo_polygon1_noindex.js b/jstests/core/geo_polygon1_noindex.js
index 4fc7135c2f9..56d1cc64f59 100644
--- a/jstests/core/geo_polygon1_noindex.js
+++ b/jstests/core/geo_polygon1_noindex.js
@@ -21,7 +21,7 @@ boxBounds = [ [0,0], [0,10], [10,10], [10,0] ];
assert.eq( num , t.find( { loc : { "$within" : { "$polygon" : boxBounds } } } ).count() , "Bounding Box Test" );
//Make sure we can add object-based polygons
-assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() )
+assert.eq( num, t.find( { loc : { $within : { $polygon : { a : [-10, -10], b : [-10, 10], c : [10, 10], d : [10, -10] } } } } ).count() );
// Look in a box much bigger than the one we have data in
boxBounds = [[-100,-100], [-100, 100], [100,100], [100,-100]];
@@ -39,8 +39,8 @@ assert.writeOK(t.save({loc: [1,3] })); // Add a point that's in
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman single point" );
-t.save({ loc : [5, 3] }) // Add a point that's out right in the mouth opening
-t.save({ loc : [3, 7] }) // Add a point above the center of the head
-t.save({ loc : [3,-1] }) // Add a point below the center of the bottom
+t.save({ loc : [5, 3] }); // Add a point that's out right in the mouth opening
+t.save({ loc : [3, 7] }); // Add a point above the center of the head
+t.save({ loc : [3,-1] }); // Add a point below the center of the bottom
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman double point" );
diff --git a/jstests/core/geo_polygon2.js b/jstests/core/geo_polygon2.js
index 26477651a06..c6857341d79 100644
--- a/jstests/core/geo_polygon2.js
+++ b/jstests/core/geo_polygon2.js
@@ -135,11 +135,11 @@ for ( var test = 0; test < numTests; test++ ) {
var nextSeg = function(currTurtle, prevTurtle) {
- var pathX = currTurtle[0]
+ var pathX = currTurtle[0];
if ( currTurtle[1] < prevTurtle[1] ) {
pathX = currTurtle[0] + 1;
- pathY = prevTurtle[1]
+ pathY = prevTurtle[1];
} else if ( currTurtle[1] > prevTurtle[1] ) {
pathX = currTurtle[0];
pathY = currTurtle[1];
@@ -155,7 +155,7 @@ for ( var test = 0; test < numTests; test++ ) {
// : "
// + [pathX, pathY]);
- return [ pathX, pathY ]
+ return [ pathX, pathY ];
};
for ( var s = 1; s < turtles[t].length; s++ ) {
diff --git a/jstests/core/geo_polygon3.js b/jstests/core/geo_polygon3.js
index b144bfbc589..495ecb189b1 100644
--- a/jstests/core/geo_polygon3.js
+++ b/jstests/core/geo_polygon3.js
@@ -46,9 +46,9 @@ for( var n = 0; n < numTests; n++ ){
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).itcount() , "Pacman single point" );
- t.save({ loc : [5, 3] }) // Add a point that's out right in the mouth opening
- t.save({ loc : [3, 7] }) // Add a point above the center of the head
- t.save({ loc : [3,-1] }) // Add a point below the center of the bottom
+ t.save({ loc : [5, 3] }); // Add a point that's out right in the mouth opening
+ t.save({ loc : [3, 7] }); // Add a point above the center of the head
+ t.save({ loc : [3,-1] }); // Add a point below the center of the bottom
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).itcount() , "Pacman double point" );
}
diff --git a/jstests/core/geo_queryoptimizer.js b/jstests/core/geo_queryoptimizer.js
index 7a438bce8fb..f75afad645e 100644
--- a/jstests/core/geo_queryoptimizer.js
+++ b/jstests/core/geo_queryoptimizer.js
@@ -1,27 +1,27 @@
t = db.geo_qo1;
-t.drop()
+t.drop();
-t.ensureIndex({loc:"2d"})
+t.ensureIndex({loc:"2d"});
-t.insert({'issue':0})
-t.insert({'issue':1})
-t.insert({'issue':2})
-t.insert({'issue':2, 'loc':[30.12,-118]})
-t.insert({'issue':1, 'loc':[30.12,-118]})
-t.insert({'issue':0, 'loc':[30.12,-118]})
+t.insert({'issue':0});
+t.insert({'issue':1});
+t.insert({'issue':2});
+t.insert({'issue':2, 'loc':[30.12,-118]});
+t.insert({'issue':1, 'loc':[30.12,-118]});
+t.insert({'issue':0, 'loc':[30.12,-118]});
-assert.eq( 6 , t.find().itcount() , "A1" )
+assert.eq( 6 , t.find().itcount() , "A1" );
-assert.eq( 2 , t.find({'issue':0}).itcount() , "A2" )
+assert.eq( 2 , t.find({'issue':0}).itcount() , "A2" );
-assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "A3" )
+assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "A3" );
-assert.eq( 2 , t.find({'issue':0}).itcount() , "B1" )
+assert.eq( 2 , t.find({'issue':0}).itcount() , "B1" );
-assert.eq( 6 , t.find().itcount() , "B2" )
+assert.eq( 6 , t.find().itcount() , "B2" );
-assert.eq( 2 , t.find({'issue':0}).itcount() , "B3" )
+assert.eq( 2 , t.find({'issue':0}).itcount() , "B3" );
-assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "B4" )
+assert.eq( 1 , t.find({'issue':0,'loc':{$near:[30.12,-118]}}).itcount() , "B4" );
diff --git a/jstests/core/geo_regex0.js b/jstests/core/geo_regex0.js
index 79042b9074e..ae7fddabcf3 100644
--- a/jstests/core/geo_regex0.js
+++ b/jstests/core/geo_regex0.js
@@ -1,18 +1,18 @@
// From SERVER-2247
// Tests to make sure regex works with geo indices
-t = db.regex0
-t.drop()
+t = db.regex0;
+t.drop();
-t.ensureIndex( { point : '2d', words : 1 } )
-t.insert( { point : [ 1, 1 ], words : [ 'foo', 'bar' ] } )
+t.ensureIndex( { point : '2d', words : 1 } );
+t.insert( { point : [ 1, 1 ], words : [ 'foo', 'bar' ] } );
-regex = { words : /^f/ }
-geo = { point : { $near : [ 1, 1 ] } }
-both = { point : { $near : [ 1, 1 ] }, words : /^f/ }
+regex = { words : /^f/ };
+geo = { point : { $near : [ 1, 1 ] } };
+both = { point : { $near : [ 1, 1 ] }, words : /^f/ };
-assert.eq(1, t.find( regex ).count() )
-assert.eq(1, t.find( geo ).count() )
-assert.eq(1, t.find( both ).count() )
+assert.eq(1, t.find( regex ).count() );
+assert.eq(1, t.find( geo ).count() );
+assert.eq(1, t.find( both ).count() );
diff --git a/jstests/core/geo_s2cursorlimitskip.js b/jstests/core/geo_s2cursorlimitskip.js
index a3ccc6ac536..cbf360a45b0 100644
--- a/jstests/core/geo_s2cursorlimitskip.js
+++ b/jstests/core/geo_s2cursorlimitskip.js
@@ -1,5 +1,5 @@
// Test various cursor behaviors
-var t = db.geo_s2getmmm
+var t = db.geo_s2getmmm;
t.drop();
t.ensureIndex({geo: "2dsphere"});
@@ -47,14 +47,14 @@ for (var j = 0; j < initialAdvance; j++) {
cursor.next();
}
// We looked at (totalPointCount - initialAdvance) points, there should still be more.
-assert(cursor.hasNext())
+assert(cursor.hasNext());
// Cursor was advanced 10 times, batchSize=4 => 1 query + 2 getmore.
assert.eq(1, db.system.profile.count({op: "query", ns: t.getFullName()}));
assert.eq(2, db.system.profile.count({op: "getmore", ns: t.getFullName()}));
for (var k = initialAdvance; k < totalPointCount; k++) {
- assert(cursor.hasNext())
+ assert(cursor.hasNext());
var tmpPoint = cursor.next();
}
@@ -67,18 +67,18 @@ db.setProfilingLevel(0);
db.system.profile.drop();
// Shouldn't be any more points to look at now.
-assert(!cursor.hasNext())
+assert(!cursor.hasNext());
var someLimit = 23;
// Make sure limit does something.
-cursor = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).limit(someLimit)
+cursor = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).limit(someLimit);
// Count doesn't work here -- ignores limit/skip, so we use itcount.
-assert.eq(cursor.itcount(), someLimit)
+assert.eq(cursor.itcount(), someLimit);
// Make sure skip works by skipping some stuff ourselves.
var someSkip = 3;
-cursor = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).limit(someLimit + someSkip)
+cursor = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).limit(someLimit + someSkip);
for (var i = 0; i < someSkip; ++i) { cursor.next(); }
-var cursor2 = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).skip(someSkip).limit(someLimit)
+var cursor2 = t.find({geo: {$geoNear : {$geometry: {type: "Point", coordinates: [0.0, 0.0]}}}}).skip(someSkip).limit(someLimit);
while (cursor.hasNext()) {
assert(cursor2.hasNext());
assert.eq(cursor.next(), cursor2.next());
diff --git a/jstests/core/geo_s2dedupnear.js b/jstests/core/geo_s2dedupnear.js
index ac31e082891..1b6f11ce504 100644
--- a/jstests/core/geo_s2dedupnear.js
+++ b/jstests/core/geo_s2dedupnear.js
@@ -1,11 +1,11 @@
// Make sure that we don't return several of the same result due to faulty
// assumptions about the btree cursor. That is, don't return duplicate results.
-t = db.geo_s2dedupnear
-t.drop()
+t = db.geo_s2dedupnear;
+t.drop();
-t.ensureIndex( { geo : "2dsphere" } )
+t.ensureIndex( { geo : "2dsphere" } );
var x = { "type" : "Polygon",
- "coordinates" : [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}
-t.insert({geo: x})
-res = t.find({geo: {$geoNear: {"type" : "Point", "coordinates" : [31, 41]}}})
-assert.eq(res.itcount(), 1)
+ "coordinates" : [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]};
+t.insert({geo: x});
+res = t.find({geo: {$geoNear: {"type" : "Point", "coordinates" : [31, 41]}}});
+assert.eq(res.itcount(), 1);
diff --git a/jstests/core/geo_s2descindex.js b/jstests/core/geo_s2descindex.js
index 39d153a6e55..26c422bc04f 100644
--- a/jstests/core/geo_s2descindex.js
+++ b/jstests/core/geo_s2descindex.js
@@ -4,9 +4,9 @@
var coll = db.getCollection("twodspheredesc");
-var descriptors = [["field1", -1], ["field2", -1], ["coordinates", "2dsphere"]]
-var docA = {field1 : "a", field2 : 1, coordinates : [-118.2400013, 34.073893]}
-var docB = {field1 : "b", field2 : 1, coordinates : [-118.2400012, 34.073894]}
+var descriptors = [["field1", -1], ["field2", -1], ["coordinates", "2dsphere"]];
+var docA = {field1 : "a", field2 : 1, coordinates : [-118.2400013, 34.073893]};
+var docB = {field1 : "b", field2 : 1, coordinates : [-118.2400012, 34.073894]};
// Try both regular and near index cursors
var query = {coordinates : {$geoWithin : {$centerSphere : [[-118.240013, 34.073893],
@@ -57,7 +57,7 @@ var query = {coordinates : {$geoWithin : {$centerSphere : [[-118.240013, 34.0738
field : 1};
assert.eq(null, coll.findOne(query));
-coll.remove({})
+coll.remove({});
coll.insert({coordinates : [-118.240013, 34.073893], field : 1});
assert.neq(null, coll.findOne(query));
diff --git a/jstests/core/geo_s2disjoint_holes.js b/jstests/core/geo_s2disjoint_holes.js
index 26d94d9343a..bb6b8a4ef2c 100644
--- a/jstests/core/geo_s2disjoint_holes.js
+++ b/jstests/core/geo_s2disjoint_holes.js
@@ -78,4 +78,4 @@ assert.writeOK(t.insert({p: multiPoly}));
t.drop();
-jsTest.log("Success.")
+jsTest.log("Success.");
diff --git a/jstests/core/geo_s2dupe_points.js b/jstests/core/geo_s2dupe_points.js
index 8dd6e804c78..5b9a30e61c5 100644
--- a/jstests/core/geo_s2dupe_points.js
+++ b/jstests/core/geo_s2dupe_points.js
@@ -2,9 +2,9 @@
// s2 rejects shapes with duplicate adjacent points as invalid, but they are
// valid in GeoJSON. We store the duplicates, but internally remove them
// before indexing or querying.
-t = db.geo_s2dupe_points
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t = db.geo_s2dupe_points;
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
function testDuplicates(shapeName, shapeWithDupes, shapeWithoutDupes) {
// insert a doc with dupes
diff --git a/jstests/core/geo_s2edgecases.js b/jstests/core/geo_s2edgecases.js
index bf46baba744..6cb8ff63809 100755
--- a/jstests/core/geo_s2edgecases.js
+++ b/jstests/core/geo_s2edgecases.js
@@ -1,36 +1,36 @@
-t = db.geo_s2edgecases
-t.drop()
+t = db.geo_s2edgecases;
+t.drop();
-roundworldpoint = { "type" : "Point", "coordinates": [ 180, 0 ] }
+roundworldpoint = { "type" : "Point", "coordinates": [ 180, 0 ] };
// Opposite the equator
roundworld = { "type" : "Polygon",
- "coordinates" : [ [ [179,1], [-179,1], [-179,-1], [179,-1], [179,1]]]}
-t.insert({geo : roundworld})
+ "coordinates" : [ [ [179,1], [-179,1], [-179,-1], [179,-1], [179,1]]]};
+t.insert({geo : roundworld});
roundworld2 = { "type" : "Polygon",
- "coordinates" : [ [ [179,1], [179,-1], [-179,-1], [-179,1], [179,1]]]}
-t.insert({geo : roundworld2})
+ "coordinates" : [ [ [179,1], [179,-1], [-179,-1], [-179,1], [179,1]]]};
+t.insert({geo : roundworld2});
// North pole
-santapoint = { "type" : "Point", "coordinates": [ 180, 90 ] }
+santapoint = { "type" : "Point", "coordinates": [ 180, 90 ] };
santa = { "type" : "Polygon",
- "coordinates" : [ [ [179,89], [179,90], [-179,90], [-179,89], [179,89]]]}
-t.insert({geo : santa})
+ "coordinates" : [ [ [179,89], [179,90], [-179,90], [-179,89], [179,89]]]};
+t.insert({geo : santa});
santa2 = { "type" : "Polygon",
- "coordinates" : [ [ [179,89], [-179,89], [-179,90], [179,90], [179,89]]]}
-t.insert({geo : santa2})
+ "coordinates" : [ [ [179,89], [-179,89], [-179,90], [179,90], [179,89]]]};
+t.insert({geo : santa2});
// South pole
-penguinpoint = { "type" : "Point", "coordinates": [ 0, -90 ] }
+penguinpoint = { "type" : "Point", "coordinates": [ 0, -90 ] };
penguin1 = { "type" : "Polygon",
- "coordinates" : [ [ [0,-89], [0,-90], [179,-90], [179,-89], [0,-89]]]}
-t.insert({geo : penguin1})
+ "coordinates" : [ [ [0,-89], [0,-90], [179,-90], [179,-89], [0,-89]]]};
+t.insert({geo : penguin1});
penguin2 = { "type" : "Polygon",
- "coordinates" : [ [ [0,-89], [179,-89], [179,-90], [0,-90], [0,-89]]]}
-t.insert({geo : penguin2})
+ "coordinates" : [ [ [0,-89], [179,-89], [179,-90], [0,-90], [0,-89]]]};
+t.insert({geo : penguin2});
-t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } )
+t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } );
res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : roundworldpoint} } });
assert.eq(res.count(), 2);
diff --git a/jstests/core/geo_s2exact.js b/jstests/core/geo_s2exact.js
index a7cf9627765..29150d63376 100644
--- a/jstests/core/geo_s2exact.js
+++ b/jstests/core/geo_s2exact.js
@@ -1,21 +1,21 @@
// Queries on exact geometry should return the exact geometry.
-t = db.geo_s2exact
-t.drop()
+t = db.geo_s2exact;
+t.drop();
function test(geometry) {
- t.insert({geo: geometry})
- assert.eq(1, t.find({geo: geometry}).itcount(), geometry)
- t.ensureIndex({geo: "2dsphere"})
- assert.eq(1, t.find({geo: geometry}).itcount(), geometry)
- t.dropIndex({geo: "2dsphere"})
+ t.insert({geo: geometry});
+ assert.eq(1, t.find({geo: geometry}).itcount(), geometry);
+ t.ensureIndex({geo: "2dsphere"});
+ assert.eq(1, t.find({geo: geometry}).itcount(), geometry);
+ t.dropIndex({geo: "2dsphere"});
}
-pointA = { "type" : "Point", "coordinates": [ 40, 5 ] }
-test(pointA)
+pointA = { "type" : "Point", "coordinates": [ 40, 5 ] };
+test(pointA);
-someline = { "type" : "LineString", "coordinates": [ [ 40, 5], [41, 6]]}
-test(someline)
+someline = { "type" : "LineString", "coordinates": [ [ 40, 5], [41, 6]]};
+test(someline);
somepoly = { "type" : "Polygon",
- "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]}
-test(somepoly)
+ "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]};
+test(somepoly);
diff --git a/jstests/core/geo_s2holesameasshell.js b/jstests/core/geo_s2holesameasshell.js
index 89ba5ef571b..91c05ca4979 100644
--- a/jstests/core/geo_s2holesameasshell.js
+++ b/jstests/core/geo_s2holesameasshell.js
@@ -1,5 +1,5 @@
// If polygons have holes, the holes cannot be equal to the entire geometry.
-var t = db.geo_s2holessameasshell
+var t = db.geo_s2holessameasshell;
t.drop();
t.ensureIndex({geo: "2dsphere"});
@@ -25,7 +25,7 @@ assert.writeError(t.insert({geo: polygonWithFullHole}));
// No covering to search over should give an empty result set.
assert.throws(function() {
- return t.find({geo: {$geoWithin: {$geometry: polygonWithFullHole}}}).count()})
+ return t.find({geo: {$geoWithin: {$geometry: polygonWithFullHole}}}).count();});
// Similar polygon to the one above, but is covered by two holes instead of
// one.
@@ -41,4 +41,4 @@ assert.writeError(t.insert({geo: polygonWithTwoHolesCoveringWholeArea}));
// No covering to search over should give an empty result set.
assert.throws(function() {
- return t.find({geo: {$geoWithin: {$geometry: polygonWithTwoHolesCoveringWholeArea}}}).count()})
+ return t.find({geo: {$geoWithin: {$geometry: polygonWithTwoHolesCoveringWholeArea}}}).count();});
diff --git a/jstests/core/geo_s2index.js b/jstests/core/geo_s2index.js
index 868b2c9dcda..1909fb95783 100755
--- a/jstests/core/geo_s2index.js
+++ b/jstests/core/geo_s2index.js
@@ -1,37 +1,37 @@
-t = db.geo_s2index
-t.drop()
+t = db.geo_s2index;
+t.drop();
// We internally drop adjacent duplicate points in lines.
-someline = { "type" : "LineString", "coordinates": [ [40,5], [40,5], [ 40, 5], [41, 6], [41,6]]}
-t.insert( {geo : someline , nonGeo: "someline"})
-t.ensureIndex({geo: "2dsphere"})
+someline = { "type" : "LineString", "coordinates": [ [40,5], [40,5], [ 40, 5], [41, 6], [41,6]]};
+t.insert( {geo : someline , nonGeo: "someline"});
+t.ensureIndex({geo: "2dsphere"});
foo = t.find({geo: {$geoIntersects: {$geometry: {type: "Point", coordinates: [40,5]}}}}).next();
assert.eq(foo.geo, someline);
-t.dropIndex({geo: "2dsphere"})
+t.dropIndex({geo: "2dsphere"});
-pointA = { "type" : "Point", "coordinates": [ 40, 5 ] }
-t.insert( {geo : pointA , nonGeo: "pointA"})
+pointA = { "type" : "Point", "coordinates": [ 40, 5 ] };
+t.insert( {geo : pointA , nonGeo: "pointA"});
-pointD = { "type" : "Point", "coordinates": [ 41.001, 6.001 ] }
-t.insert( {geo : pointD , nonGeo: "pointD"})
+pointD = { "type" : "Point", "coordinates": [ 41.001, 6.001 ] };
+t.insert( {geo : pointD , nonGeo: "pointD"});
-pointB = { "type" : "Point", "coordinates": [ 41, 6 ] }
-t.insert( {geo : pointB , nonGeo: "pointB"})
+pointB = { "type" : "Point", "coordinates": [ 41, 6 ] };
+t.insert( {geo : pointB , nonGeo: "pointB"});
-pointC = { "type" : "Point", "coordinates": [ 41, 6 ] }
-t.insert( {geo : pointC} )
+pointC = { "type" : "Point", "coordinates": [ 41, 6 ] };
+t.insert( {geo : pointC} );
// Add a point within the polygon but not on the border. Don't want to be on
// the path of the polyline.
-pointE = { "type" : "Point", "coordinates": [ 40.6, 5.4 ] }
-t.insert( {geo : pointE} )
+pointE = { "type" : "Point", "coordinates": [ 40.6, 5.4 ] };
+t.insert( {geo : pointE} );
// Make sure we can index this without error.
-t.insert({nonGeo: "noGeoField!"})
+t.insert({nonGeo: "noGeoField!"});
somepoly = { "type" : "Polygon",
- "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]}
-t.insert( {geo : somepoly, nonGeo: "somepoly" })
+ "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]};
+t.insert( {geo : somepoly, nonGeo: "somepoly" });
var res = t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } );
// We have a point without any geo data. Don't error.
@@ -46,39 +46,39 @@ assert.eq(res.itcount(), 4);
res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : pointD} } });
assert.eq(res.itcount(), 1);
-res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : someline} } })
+res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : someline} } });
assert.eq(res.itcount(), 5);
-res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } })
+res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 6);
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 6);
-res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } }).limit(1)
+res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } }).limit(1);
assert.eq(res.itcount(), 1);
res = t.find({ "nonGeo": "pointA",
- "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } })
+ "geo" : { "$geoIntersects" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
// Don't crash mongod if we give it bad input.
-t.drop()
-t.ensureIndex({loc: "2dsphere", x:1})
-t.save({loc: [0,0]})
-assert.throws(function() { return t.count({loc: {$foo:[0,0]}}) })
+t.drop();
+t.ensureIndex({loc: "2dsphere", x:1});
+t.save({loc: [0,0]});
+assert.throws(function() { return t.count({loc: {$foo:[0,0]}}); });
assert.throws(function() { return t.find({ "nonGeo": "pointA",
"geo" : { "$geoIntersects" : { "$geometry" : somepoly},
- "$near": {"$geometry" : somepoly }}}).count()})
+ "$near": {"$geometry" : somepoly }}}).count();});
// If we specify a datum, it has to be valid (WGS84).
-t.drop()
-t.ensureIndex({loc: "2dsphere"})
+t.drop();
+t.ensureIndex({loc: "2dsphere"});
res = t.insert({ loc: { type: 'Point',
coordinates: [40, 5],
crs: { type: 'name', properties: { name: 'EPSG:2000' }}}});
assert.writeError(res);
-assert.eq(0, t.find().itcount())
+assert.eq(0, t.find().itcount());
res = t.insert({ loc: { type: 'Point', coordinates: [40, 5] }});
assert.writeOK(res);
res = t.insert({ loc: { type: 'Point',
@@ -94,7 +94,7 @@ assert.writeOK(res);
// We can pass level parameters and we verify that they're valid.
// 0 <= coarsestIndexedLevel <= finestIndexedLevel <= 30.
t.drop();
-t.save({loc: [0,0]})
+t.save({loc: [0,0]});
res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 17, coarsestIndexedLevel: 5 });
assert.commandWorked(res);
// Ensure the index actually works at a basic level
@@ -102,12 +102,12 @@ assert.neq(null,
t.findOne({ loc : { $geoNear : { $geometry : { type: 'Point', coordinates: [0, 0] } } } }));
t.drop();
-t.save({loc: [0,0]})
+t.save({loc: [0,0]});
res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 31, coarsestIndexedLevel: 5 });
assert.commandFailed(res);
t.drop();
-t.save({loc: [0,0]})
+t.save({loc: [0,0]});
res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 30, coarsestIndexedLevel: 0 });
assert.commandWorked(res);
//Ensure the index actually works at a basic level
diff --git a/jstests/core/geo_s2indexoldformat.js b/jstests/core/geo_s2indexoldformat.js
index e2cc1f353ee..4ed0afba8dd 100755
--- a/jstests/core/geo_s2indexoldformat.js
+++ b/jstests/core/geo_s2indexoldformat.js
@@ -1,20 +1,20 @@
// Make sure that the 2dsphere index can deal with non-GeoJSON points.
// 2dsphere does not accept legacy shapes, only legacy points.
-t = db.geo_s2indexoldformat
-t.drop()
+t = db.geo_s2indexoldformat;
+t.drop();
-t.insert( {geo : [40, 5], nonGeo: ["pointA"]})
-t.insert( {geo : [41.001, 6.001], nonGeo: ["pointD"]})
-t.insert( {geo : [41, 6], nonGeo: ["pointB"]})
-t.insert( {geo : [41, 6]} )
-t.insert( {geo : {x:40.6, y:5.4}} )
+t.insert( {geo : [40, 5], nonGeo: ["pointA"]});
+t.insert( {geo : [41.001, 6.001], nonGeo: ["pointD"]});
+t.insert( {geo : [41, 6], nonGeo: ["pointB"]});
+t.insert( {geo : [41, 6]} );
+t.insert( {geo : {x:40.6, y:5.4}} );
-t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } )
+t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } );
-res = t.find({ "geo" : { "$geoIntersects" : { "$geometry": {x:40, y:5}}}})
+res = t.find({ "geo" : { "$geoIntersects" : { "$geometry": {x:40, y:5}}}});
assert.eq(res.count(), 1);
-res = t.find({ "geo" : { "$geoIntersects" : {"$geometry": [41,6]}}})
+res = t.find({ "geo" : { "$geoIntersects" : {"$geometry": [41,6]}}});
assert.eq(res.count(), 2);
// We don't support legacy polygons in 2dsphere.
diff --git a/jstests/core/geo_s2intersection.js b/jstests/core/geo_s2intersection.js
index 35cc531c7eb..287d52dfe10 100644
--- a/jstests/core/geo_s2intersection.js
+++ b/jstests/core/geo_s2intersection.js
@@ -1,5 +1,5 @@
-var t = db.geo_s2intersectinglines
-t.drop()
+var t = db.geo_s2intersectinglines;
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
/* All the tests in this file are generally confirming intersections based upon
@@ -50,7 +50,7 @@ assert.eq(result[0]['name'], 'canonLine');
var testPoly = {type: "Polygon",
coordinates: [
[[0.4, -0.1],[0.4, 0.1], [0.6, 0.1], [0.6, -0.1], [0.4, -0.1]]
- ]}
+ ]};
result = t.find({geo: {$geoIntersects: {$geometry: testPoly}}});
assert.eq(result.count(), 1);
@@ -117,7 +117,7 @@ assert.eq(result[0]['name'], 'canonPoint');
// as above but with an identical point to the canonPoint. We expect an
// intersection here.
testPoint = {type: "Point",
- coordinates: [10.0, 10.0]}
+ coordinates: [10.0, 10.0]};
result = t.find({geo: {$geoIntersects: {$geometry: testPoint}}});
assert.eq(result.count(), 1);
@@ -126,7 +126,7 @@ assert.eq(result[0]['name'], 'canonPoint');
//Case 10: Sanity point non-intersection.
var testPoint = {type: "Point",
- coordinates: [12.0, 12.0]}
+ coordinates: [12.0, 12.0]};
result = t.find({geo: {$geoIntersects: {$geometry: testPoint}}});
assert.eq(result.count(), 0);
@@ -134,7 +134,7 @@ assert.eq(result.count(), 0);
// Case 11: Point polygon intersection
// verify that a point inside a polygon $geoIntersects.
testPoint = {type: "Point",
- coordinates: [50.5, 50.5]}
+ coordinates: [50.5, 50.5]};
result = t.find({geo: {$geoIntersects: {$geometry: testPoint}}});
assert.eq(result.count(), 1);
diff --git a/jstests/core/geo_s2largewithin.js b/jstests/core/geo_s2largewithin.js
index 2327f1fb02d..bd4ccafdae1 100644
--- a/jstests/core/geo_s2largewithin.js
+++ b/jstests/core/geo_s2largewithin.js
@@ -1,7 +1,7 @@
// If our $within is enormous, create a coarse covering for the search so it
// doesn't take forever.
-t = db.geo_s2largewithin
-t.drop()
+t = db.geo_s2largewithin;
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
testPoint = {
@@ -42,4 +42,4 @@ longPoly = {type: "Polygon",
result = t.find({geo: {$geoWithin: {$geometry: longPoly}}});
assert.eq(result.itcount(), 1);
result = t.find({geo: {$geoWithin: {$geometry: longPoly}}});
-assert.eq("origin", result[0].name)
+assert.eq("origin", result[0].name);
diff --git a/jstests/core/geo_s2meridian.js b/jstests/core/geo_s2meridian.js
index 6bc7dc735f2..feb1dbefed5 100644
--- a/jstests/core/geo_s2meridian.js
+++ b/jstests/core/geo_s2meridian.js
@@ -25,7 +25,7 @@ lineAlongMeridian = {
[180.0, 11.0],
[180.0, 9.0]
]
-}
+};
result = t.find({geo: {$geoIntersects: {$geometry: lineAlongMeridian}}});
assert.eq(result.itcount(), 1);
diff --git a/jstests/core/geo_s2multi.js b/jstests/core/geo_s2multi.js
index eef5af628b2..8d86f8ad08c 100644
--- a/jstests/core/geo_s2multi.js
+++ b/jstests/core/geo_s2multi.js
@@ -1,21 +1,21 @@
-t = db.geo_s2multi
-t.drop()
+t = db.geo_s2multi;
+t.drop();
-t.ensureIndex({geo: "2dsphere"})
+t.ensureIndex({geo: "2dsphere"});
// Let's try the examples in the GeoJSON spec.
-multiPointA = { "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
+multiPointA = { "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] };
assert.writeOK(t.insert({geo: multiPointA}));
multiLineStringA = { "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ],
- [ [102.0, 2.0], [103.0, 3.0] ]]}
+ [ [102.0, 2.0], [103.0, 3.0] ]]};
assert.writeOK(t.insert({geo: multiLineStringA}));
multiPolygonA = { "type": "MultiPolygon", "coordinates": [
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
- [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]]}
-assert.writeOK(t.insert({geo: multiPolygonA}))
+ [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]]};
+assert.writeOK(t.insert({geo: multiPolygonA}));
assert.eq(3, t.find({geo: {$geoIntersects: {$geometry:
{"type": "Point", "coordinates": [100,0]}}}}).itcount());
diff --git a/jstests/core/geo_s2near.js b/jstests/core/geo_s2near.js
index 240e10d633a..5d0da52b6ec 100644
--- a/jstests/core/geo_s2near.js
+++ b/jstests/core/geo_s2near.js
@@ -1,87 +1,87 @@
// Test 2dsphere near search, called via find and geoNear.
-t = db.geo_s2near
+t = db.geo_s2near;
t.drop();
// Make sure that geoNear gives us back loc
-goldenPoint = {type: "Point", coordinates: [ 31.0, 41.0]}
-t.insert({geo: goldenPoint})
-t.ensureIndex({ geo : "2dsphere" })
-resNear = db.runCommand({geoNear : t.getName(), near: [30, 40], num: 1, spherical: true, includeLocs: true})
-assert.eq(resNear.results[0].loc, goldenPoint)
+goldenPoint = {type: "Point", coordinates: [ 31.0, 41.0]};
+t.insert({geo: goldenPoint});
+t.ensureIndex({ geo : "2dsphere" });
+resNear = db.runCommand({geoNear : t.getName(), near: [30, 40], num: 1, spherical: true, includeLocs: true});
+assert.eq(resNear.results[0].loc, goldenPoint);
// FYI:
// One degree of long @ 0 is 111km or so.
// One degree of lat @ 0 is 110km or so.
-lat = 0
-lng = 0
-points = 10
+lat = 0;
+lng = 0;
+points = 10;
for (var x = -points; x < points; x += 1) {
for (var y = -points; y < points; y += 1) {
- t.insert({geo : { "type" : "Point", "coordinates" : [lng + x/1000.0, lat + y/1000.0]}})
+ t.insert({geo : { "type" : "Point", "coordinates" : [lng + x/1000.0, lat + y/1000.0]}});
}
}
-origin = { "type" : "Point", "coordinates": [ lng, lat ] }
+origin = { "type" : "Point", "coordinates": [ lng, lat ] };
-t.ensureIndex({ geo : "2dsphere" })
+t.ensureIndex({ geo : "2dsphere" });
// Near only works when the query is a point.
-someline = { "type" : "LineString", "coordinates": [ [ 40, 5], [41, 6]]}
+someline = { "type" : "LineString", "coordinates": [ [ 40, 5], [41, 6]]};
somepoly = { "type" : "Polygon",
- "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]}
-assert.throws(function() { return t.find({ "geo" : { "$near" : { "$geometry" : someline } } }).count()})
-assert.throws(function() { return t.find({ "geo" : { "$near" : { "$geometry" : somepoly } } }).count()})
-assert.throws(function() { return db.runCommand({geoNear : t.getName(), near: someline, spherical:true }).results.length})
-assert.throws(function() { return db.runCommand({geoNear : t.getName(), near: somepoly, spherical:true }).results.length})
+ "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]};
+assert.throws(function() { return t.find({ "geo" : { "$near" : { "$geometry" : someline } } }).count();});
+assert.throws(function() { return t.find({ "geo" : { "$near" : { "$geometry" : somepoly } } }).count();});
+assert.throws(function() { return db.runCommand({geoNear : t.getName(), near: someline, spherical:true }).results.length;});
+assert.throws(function() { return db.runCommand({geoNear : t.getName(), near: somepoly, spherical:true }).results.length;});
// Do some basic near searches.
-res = t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: 2000} } }).limit(10)
-resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10, maxDistance: Math.PI, spherical: true})
-assert.eq(res.itcount(), resNear.results.length, 10)
+res = t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: 2000} } }).limit(10);
+resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10, maxDistance: Math.PI, spherical: true});
+assert.eq(res.itcount(), resNear.results.length, 10);
-res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10)
-resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10, spherical: true})
-assert.eq(res.itcount(), resNear.results.length, 10)
+res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10);
+resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10, spherical: true});
+assert.eq(res.itcount(), resNear.results.length, 10);
// Find all the points!
-res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10000)
-resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10000, spherical: true})
-assert.eq(resNear.results.length, res.itcount(), (2 * points) * (2 * points))
+res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10000);
+resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10000, spherical: true});
+assert.eq(resNear.results.length, res.itcount(), (2 * points) * (2 * points));
// longitude goes -180 to 180
// latitude goes -90 to 90
// Let's put in some perverse (polar) data and make sure we get it back.
// Points go long, lat.
-t.insert({geo: { "type" : "Point", "coordinates" : [-180, -90]}})
-t.insert({geo: { "type" : "Point", "coordinates" : [180, -90]}})
-t.insert({geo: { "type" : "Point", "coordinates" : [180, 90]}})
-t.insert({geo: { "type" : "Point", "coordinates" : [-180, 90]}})
-res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10000)
-resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10000, spherical: true})
-assert.eq(res.itcount(), resNear.results.length, (2 * points) * (2 * points) + 4)
+t.insert({geo: { "type" : "Point", "coordinates" : [-180, -90]}});
+t.insert({geo: { "type" : "Point", "coordinates" : [180, -90]}});
+t.insert({geo: { "type" : "Point", "coordinates" : [180, 90]}});
+t.insert({geo: { "type" : "Point", "coordinates" : [-180, 90]}});
+res = t.find({ "geo" : { "$near" : { "$geometry" : origin } } }).limit(10000);
+resNear = db.runCommand({geoNear : t.getName(), near: [0,0], num: 10000, spherical: true});
+assert.eq(res.itcount(), resNear.results.length, (2 * points) * (2 * points) + 4);
function testRadAndDegreesOK(distance) {
// Distance for old style points is radians.
- resRadians = t.find({geo: {$nearSphere: [0,0], $maxDistance: (distance / (6378.1 * 1000))}})
+ resRadians = t.find({geo: {$nearSphere: [0,0], $maxDistance: (distance / (6378.1 * 1000))}});
// Distance for new style points is meters.
- resMeters = t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: distance} } })
+ resMeters = t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: distance} } });
// And we should get the same # of results no matter what.
- assert.eq(resRadians.itcount(), resMeters.itcount())
+ assert.eq(resRadians.itcount(), resMeters.itcount());
// Also, geoNear should behave the same way.
- resGNMeters = db.runCommand({geoNear : t.getName(), near: origin, maxDistance: distance, spherical: true})
- resGNRadians = db.runCommand({geoNear : t.getName(), near: [0,0], maxDistance: (distance / (6378.1 * 1000)), spherical: true})
- assert.eq(resGNRadians.results.length, resGNMeters.results.length)
+ resGNMeters = db.runCommand({geoNear : t.getName(), near: origin, maxDistance: distance, spherical: true});
+ resGNRadians = db.runCommand({geoNear : t.getName(), near: [0,0], maxDistance: (distance / (6378.1 * 1000)), spherical: true});
+ assert.eq(resGNRadians.results.length, resGNMeters.results.length);
for (var i = 0; i < resGNRadians.length; ++i) {
// Radius of earth * radians = distance in meters.
- assert.close(resGNRadians.results[i].dis * 6378.1 * 1000, resGNMeters.results[i].dis)
+ assert.close(resGNRadians.results[i].dis * 6378.1 * 1000, resGNMeters.results[i].dis);
}
}
testRadAndDegreesOK(1);
-testRadAndDegreesOK(10)
-testRadAndDegreesOK(50)
-testRadAndDegreesOK(10000)
+testRadAndDegreesOK(10);
+testRadAndDegreesOK(50);
+testRadAndDegreesOK(10000);
// SERVER-13666 legacy coordinates must be in bounds for spherical near queries.
assert.commandFailed(db.runCommand({geoNear : t.getName(), near: [1210.466, 31.2051], spherical: true, num: 10}));
diff --git a/jstests/core/geo_s2nearComplex.js b/jstests/core/geo_s2nearComplex.js
index e6fa1f77bd7..ecb5e646a54 100644
--- a/jstests/core/geo_s2nearComplex.js
+++ b/jstests/core/geo_s2nearComplex.js
@@ -1,6 +1,6 @@
-var t = db.get_s2nearcomplex
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+var t = db.get_s2nearcomplex;
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
/* Short names for math operations */
Random.setRandomSeed();
@@ -9,7 +9,7 @@ var PI = Math.PI;
var asin = Math.asin;
var sin = Math.sin;
var cos = Math.cos;
-var atan2 = Math.atan2
+var atan2 = Math.atan2;
var originGeo = {type: "Point", coordinates: [20.0, 20.0]};
@@ -17,7 +17,7 @@ var originGeo = {type: "Point", coordinates: [20.0, 20.0]};
var origin = {
name: "origin",
geo: originGeo
-}
+};
/*
@@ -25,9 +25,9 @@ var origin = {
* specify how accurate equals should be.
*/
function coordinateEqual(first, second, threshold){
- threshold = threshold || 0.001
- first = first['geo']['coordinates']
- second = second['geo']['coordinates']
+ threshold = threshold || 0.001;
+ first = first['geo']['coordinates'];
+ second = second['geo']['coordinates'];
if(Math.abs(first[0] - second[0]) <= threshold){
if(Math.abs(first[1] - second[1]) <= threshold){
return true;
@@ -106,7 +106,7 @@ function uniformPointsWithGaps(origin, count, minDist, maxDist, numberOfHoles, s
* covers as a fraction of the full area that points are created on. Defaults to 10.
*/
function uniformPointsWithClusters(origin, count, minDist, maxDist, numberOfClusters, minClusterSize, maxClusterSize, distRatio){
- distRatio = distRatio || 10
+ distRatio = distRatio || 10;
var points = uniformPoints(origin, count, minDist, maxDist);
for(j=0; j<numberOfClusters; j++){
var randomPoint = points[Math.floor(random() * points.length)];
@@ -161,40 +161,40 @@ var query = {geo: {$geoNear: {$geometry: originGeo}}};
// Test a uniform distribution of 1000 points.
uniformPoints(origin, 1000, 0.5, 1.5);
-validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
+validateOrdering({geo: {$geoNear: {$geometry: originGeo}}});
-print("Millis for uniform:")
+print("Millis for uniform:");
print(t.find(query).explain("executionStats").executionStats.executionTimeMillis);
print("Total points:");
print(t.find(query).itcount());
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
// Test a uniform distribution with 5 gaps each with 10 points missing.
uniformPointsWithGaps(origin, 1000, 1, 10.0, 5, 10);
-validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
+validateOrdering({geo: {$geoNear: {$geometry: originGeo}}});
-print("Millis for uniform with gaps:")
+print("Millis for uniform with gaps:");
print(t.find(query).explain("executionStats").executionStats.executionTimeMillis);
print("Total points:");
print(t.find(query).itcount());
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
// Test a uniform distribution with 5 clusters each with between 10 and 100 points.
uniformPointsWithClusters(origin, 1000, 1, 10.0, 5, 10, 100);
-validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
+validateOrdering({geo: {$geoNear: {$geometry: originGeo}}});
print("Millis for uniform with clusters:");
print(t.find(query).explain("executionStats").executionStats.executionTimeMillis);
print("Total points:");
print(t.find(query).itcount());
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
// Test a uniform near search with origin around the pole.
@@ -203,46 +203,46 @@ originGeo = {type: "Point", coordinates: [0.0, 89.0]};
origin = {
name: "origin",
geo: originGeo
-}
+};
uniformPoints(origin, 50, 0.5, 1.5);
-validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
+validateOrdering({geo: {$geoNear: {$geometry: originGeo}}});
-print("Millis for uniform near pole:")
+print("Millis for uniform near pole:");
print(t.find({geo: {$geoNear: {$geometry: originGeo}}})
.explain("executionStats").executionStats.executionTimeMillis);
assert.eq(t.find({geo: {$geoNear: {$geometry: originGeo}}}).itcount(), 50);
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
// Center point near the meridian
originGeo = {type: "Point", coordinates: [179.0, 0.0]};
origin = {
name: "origin",
geo: originGeo
-}
+};
uniformPoints(origin, 50, 0.5, 1.5);
-validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
+validateOrdering({geo: {$geoNear: {$geometry: originGeo}}});
-print("Millis for uniform on meridian:")
+print("Millis for uniform on meridian:");
print(t.find({geo: {$geoNear: {$geometry: originGeo}}})
.explain("executionStats").executionStats.executionTimeMillis);
assert.eq(t.find({geo: {$geoNear: {$geometry: originGeo}}}).itcount(), 50);
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
// Center point near the negative meridian
originGeo = {type: "Point", coordinates: [-179.0, 0.0]};
origin = {
name: "origin",
geo: originGeo
-}
+};
uniformPoints(origin, 50, 0.5, 1.5);
-validateOrdering({geo: {$near: {$geometry: originGeo}}})
+validateOrdering({geo: {$near: {$geometry: originGeo}}});
print("Millis for uniform on negative meridian:");
print(t.find({geo: {$geoNear: {$geometry: originGeo}}})
@@ -250,23 +250,23 @@ print(t.find({geo: {$geoNear: {$geometry: originGeo}}})
assert.eq(t.find({geo: {$near: {$geometry: originGeo}}}).itcount(), 50);
// Near search with points that are really far away.
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
originGeo = {type: "Point", coordinates: [0.0, 0.0]};
origin = {
name: "origin",
geo: originGeo
-}
+};
uniformPoints(origin, 10, 89, 90);
-cur = t.find({geo: {$near: {$geometry: originGeo}}})
+cur = t.find({geo: {$near: {$geometry: originGeo}}});
assert.eq(cur.itcount(), 10);
-cur = t.find({geo: {$near: {$geometry: originGeo}}})
+cur = t.find({geo: {$near: {$geometry: originGeo}}});
print("Near search on very distant points:");
print(t.find({geo: {$geoNear: {$geometry: originGeo}}})
.explain("executionStats").executionStats.executionTimeMillis);
pt = cur.next();
-assert(pt)
+assert(pt);
diff --git a/jstests/core/geo_s2nearcorrect.js b/jstests/core/geo_s2nearcorrect.js
index cdb5404a08d..9fdeb4aa6a3 100644
--- a/jstests/core/geo_s2nearcorrect.js
+++ b/jstests/core/geo_s2nearcorrect.js
@@ -2,11 +2,11 @@
// A geometry may have several covers, one of which is in a search ring and the other of which is
// not. If we see the cover that's not in the search ring, we can't mark the object as 'seen' for
// this ring.
-t = db.geo_s2nearcorrect
-t.drop()
+t = db.geo_s2nearcorrect;
+t.drop();
longline = { "type" : "LineString", "coordinates": [ [0,0], [179, 89]]};
t.insert({geo: longline});
t.ensureIndex({geo: "2dsphere"});
-origin = { "type" : "Point", "coordinates": [ 45, 45] }
+origin = { "type" : "Point", "coordinates": [ 45, 45] };
assert.eq(1, t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: 20000000} } }).count());
diff --git a/jstests/core/geo_s2nearwithin.js b/jstests/core/geo_s2nearwithin.js
index 5df27581e5f..1e5a20d5209 100644
--- a/jstests/core/geo_s2nearwithin.js
+++ b/jstests/core/geo_s2nearwithin.js
@@ -1,17 +1,17 @@
// Test geoNear + $within.
-t = db.geo_s2nearwithin
+t = db.geo_s2nearwithin;
t.drop();
-points = 10
+points = 10;
for (var x = -points; x < points; x += 1) {
for (var y = -points; y < points; y += 1) {
- t.insert({geo: [x, y]})
+ t.insert({geo: [x, y]});
}
}
-origin = { "type" : "Point", "coordinates": [ 0, 0] }
+origin = { "type" : "Point", "coordinates": [ 0, 0] };
-t.ensureIndex({ geo : "2dsphere" })
+t.ensureIndex({ geo : "2dsphere" });
// Near requires an index, and 2dsphere is an index. Spherical isn't
// specified so this doesn't work.
assert.commandFailed( db.runCommand({ geoNear: t.getName(), near: [0, 0],
@@ -21,21 +21,21 @@ assert.commandFailed( db.runCommand({ geoNear: t.getName(), near: [0, 0],
// because you can use them with both $center and $centerSphere. Points are
// the only things we will do this conversion for.
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], spherical: true,
- query: {geo: {$within: {$center: [[0, 0], 1]}}}})
-assert.eq(resNear.results.length, 5)
+ query: {geo: {$within: {$center: [[0, 0], 1]}}}});
+assert.eq(resNear.results.length, 5);
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], spherical: true,
- query: {geo: {$within: {$centerSphere: [[0, 0], Math.PI/180.0]}}}})
-assert.eq(resNear.results.length, 5)
+ query: {geo: {$within: {$centerSphere: [[0, 0], Math.PI/180.0]}}}});
+assert.eq(resNear.results.length, 5);
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], spherical: true,
- query: {geo: {$within: {$centerSphere: [[0, 0], 0]}}}})
-assert.eq(resNear.results.length, 1)
+ query: {geo: {$within: {$centerSphere: [[0, 0], 0]}}}});
+assert.eq(resNear.results.length, 1);
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], spherical: true,
- query: {geo: {$within: {$centerSphere: [[1, 0], 0.5 * Math.PI/180.0]}}}})
-assert.eq(resNear.results.length, 1)
+ query: {geo: {$within: {$centerSphere: [[1, 0], 0.5 * Math.PI/180.0]}}}});
+assert.eq(resNear.results.length, 1);
resNear = db.runCommand({geoNear : t.getName(), near: [0, 0], spherical: true,
- query: {geo: {$within: {$center: [[1, 0], 1.5]}}}})
-assert.eq(resNear.results.length, 9)
+ query: {geo: {$within: {$center: [[1, 0], 1.5]}}}});
+assert.eq(resNear.results.length, 9);
diff --git a/jstests/core/geo_s2nongeoarray.js b/jstests/core/geo_s2nongeoarray.js
index 85a01aaedae..067c338faf3 100644
--- a/jstests/core/geo_s2nongeoarray.js
+++ b/jstests/core/geo_s2nongeoarray.js
@@ -1,8 +1,8 @@
// Explode arrays when indexing non-geo fields in 2dsphere, and make sure that
// we find them with queries.
-t = db.geo_s2nongeoarray
+t = db.geo_s2nongeoarray;
-oldPoint = [40,5]
+oldPoint = [40,5];
var data = {geo: oldPoint, nonGeo: [123,456], otherNonGeo: [{b:[1,2]},{b:[3,4]}]};
@@ -15,12 +15,12 @@ assert.eq(1, t.find({'otherNonGeo.b': 1}).itcount());
t.drop();
t.insert(data);
-t.ensureIndex({geo: "2d", nonGeo: 1, otherNonGeo: 1})
+t.ensureIndex({geo: "2d", nonGeo: 1, otherNonGeo: 1});
assert.eq(t.find({nonGeo: 123, geo: {$nearSphere: oldPoint}}).itcount(), 1);
assert.eq(t.find({'otherNonGeo.b': 1, geo: {$nearSphere: oldPoint}}).itcount(), 1);
-t.drop()
+t.drop();
t.insert(data);
-t.ensureIndex({geo: "2dsphere", nonGeo: 1, otherNonGeo: 1})
+t.ensureIndex({geo: "2dsphere", nonGeo: 1, otherNonGeo: 1});
assert.eq(t.find({nonGeo: 123, geo: {$nearSphere: oldPoint}}).itcount(), 1);
assert.eq(t.find({'otherNonGeo.b': 1, geo: {$nearSphere: oldPoint}}).itcount(), 1);
diff --git a/jstests/core/geo_s2nonstring.js b/jstests/core/geo_s2nonstring.js
index 11fc8f4f4c4..1f3258eeac3 100755
--- a/jstests/core/geo_s2nonstring.js
+++ b/jstests/core/geo_s2nonstring.js
@@ -1,13 +1,13 @@
// Added to make sure that S2 indexing's string AND non-string keys work.
-t = db.geo_s2nonstring
-t.drop()
+t = db.geo_s2nonstring;
+t.drop();
t.ensureIndex( { geo:'2dsphere', x:1 } );
t.save( { geo:{ type:'Point', coordinates:[ 0, 0 ] }, x:'a' } );
t.save( { geo:{ type:'Point', coordinates:[ 0, 0 ] }, x:5 } );
-t.drop()
+t.drop();
t.ensureIndex( { geo:'2dsphere', x:1 } );
t.save( { geo:{ type:'Point', coordinates:[ 0, 0 ] }, x:'a' } );
diff --git a/jstests/core/geo_s2nopoints.js b/jstests/core/geo_s2nopoints.js
index c897f39f815..903487c7008 100644
--- a/jstests/core/geo_s2nopoints.js
+++ b/jstests/core/geo_s2nopoints.js
@@ -1,7 +1,7 @@
// See SERVER-7794.
-t = db.geo_s2nopoints
-t.drop()
+t = db.geo_s2nopoints;
+t.drop();
-t.ensureIndex({loc: "2dsphere", x:1})
+t.ensureIndex({loc: "2dsphere", x:1});
assert.eq(0, t.count({loc: {$near: {$geometry: {type: 'Point', coordinates:[0,0]},
- $maxDistance: 10}}}))
+ $maxDistance: 10}}}));
diff --git a/jstests/core/geo_s2oddshapes.js b/jstests/core/geo_s2oddshapes.js
index 24a318d5b98..aa284bbe20e 100644
--- a/jstests/core/geo_s2oddshapes.js
+++ b/jstests/core/geo_s2oddshapes.js
@@ -1,8 +1,8 @@
// Verify that odd polygons (huge or "narrow") behave as we expect.
// Note that since 2dsphere is spherical, polygons that seem narrow are actually
// rather wide if their latitude (or longitude) range is large.
-var t = db.geo_s2oddshapes
-t.drop()
+var t = db.geo_s2oddshapes;
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
var testPoint = {
@@ -66,7 +66,7 @@ assert.eq(result.itcount(), 3);
//Test a poly that is the size of half the earth.
-t.drop()
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
var insidePoint = {
@@ -98,12 +98,12 @@ var largePoly = {type: "Polygon",
result = t.find({geo: {$within: {$geometry: largePoly}}});
assert.eq(result.itcount(), 1);
result = t.find({geo: {$within: {$geometry: largePoly}}});
-var point = result[0]
+var point = result[0];
assert.eq(point.name, 'inside');
//Test a poly that is very small. A couple meters around.
-t.drop()
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
insidePoint = {
@@ -133,6 +133,6 @@ smallPoly = {type: "Polygon",
result = t.find({geo: {$within: {$geometry: smallPoly}}});
assert.eq(result.itcount(), 1);
result = t.find({geo: {$within: {$geometry: smallPoly}}});
-point = result[0]
+point = result[0];
assert.eq(point.name, 'inside');
diff --git a/jstests/core/geo_s2ordering.js b/jstests/core/geo_s2ordering.js
index fa41592e773..84b78edecfb 100644
--- a/jstests/core/geo_s2ordering.js
+++ b/jstests/core/geo_s2ordering.js
@@ -2,16 +2,16 @@
// actually matters for lookup speed. That is, if we're looking for a non-geo key of which
// there are not many, the index order (nongeo, geo) should be faster than (geo, nongeo)
// for 2dsphere.
-t = db.geo_s2ordering
+t = db.geo_s2ordering;
t.drop();
-needle = "hari"
+needle = "hari";
// We insert lots of points in a region and look for a non-geo key which is rare.
function makepoints(needle) {
- lat = 0
- lng = 0
- points = 50.0
+ lat = 0;
+ lng = 0;
+ points = 50.0;
var bulk = t.initializeUnorderedBulkOp();
for (var x = -points; x < points; x += 1) {
for (var y = -points; y < points; y += 1) {
@@ -36,10 +36,10 @@ function runTest(index) {
return stats;
}
-makepoints(needle)
+makepoints(needle);
// Indexing non-geo first should be quicker.
-fast = runTest({nongeo: 1, geo: "2dsphere"})
-slow = runTest({geo: "2dsphere", nongeo: 1})
+fast = runTest({nongeo: 1, geo: "2dsphere"});
+slow = runTest({geo: "2dsphere", nongeo: 1});
// The nReturned should be the same
assert.eq(fast.nReturned, 1);
assert.eq(slow.nReturned, 1);
diff --git a/jstests/core/geo_s2overlappingpolys.js b/jstests/core/geo_s2overlappingpolys.js
index 0d96222206c..819879d960d 100644
--- a/jstests/core/geo_s2overlappingpolys.js
+++ b/jstests/core/geo_s2overlappingpolys.js
@@ -1,5 +1,5 @@
-var t = db.geo_s2overlappingpolys
-t.drop()
+var t = db.geo_s2overlappingpolys;
+t.drop();
t.ensureIndex( { geo : "2dsphere" } );
@@ -107,7 +107,7 @@ assert.eq(result.itcount(), 1);
// as though it's intersecting.
// NOTE: I think this error bound seems odd. Going to 0.000152297 will break this test.
// I've confirmed there is an error bound, but it's a lot larger than we experienced above.
-var errorBound = 0.000152298
+var errorBound = 0.000152298;
var notCloseEnoughSharedPointPoly = {type: "Polygon",
coordinates: [
[[0.0, -2.0], [0.0, -1.0 - errorBound], [1.0, -2.0], [0.0, -2.0]]
diff --git a/jstests/core/geo_s2polywithholes.js b/jstests/core/geo_s2polywithholes.js
index b3fcb51726b..85aafccdb68 100755
--- a/jstests/core/geo_s2polywithholes.js
+++ b/jstests/core/geo_s2polywithholes.js
@@ -31,8 +31,8 @@ assert.writeError(t.insert({geo: polygonWithProtrudingHole}));
// Can't search with bogus poly.
assert.throws(function() {
- return t.find({geo: {$within: {$geometry: polygonWithProtrudingHole}}}).itcount()
-})
+ return t.find({geo: {$within: {$geometry: polygonWithProtrudingHole}}}).itcount();
+});
// Test 3: This test will confirm that a polygon with overlapping holes throws
// an error.
diff --git a/jstests/core/geo_s2sparse.js b/jstests/core/geo_s2sparse.js
index 3fbc01188a3..e6454fbfbb7 100644
--- a/jstests/core/geo_s2sparse.js
+++ b/jstests/core/geo_s2sparse.js
@@ -3,7 +3,7 @@
var coll = db.geo_s2sparse;
-var point = { type: "Point", coordinates: [5, 5] }
+var point = { type: "Point", coordinates: [5, 5] };
var indexSpec = { geo: "2dsphere", nonGeo: 1 };
diff --git a/jstests/core/geo_s2twofields.js b/jstests/core/geo_s2twofields.js
index 7332c8e33e0..26c75b08bfb 100644
--- a/jstests/core/geo_s2twofields.js
+++ b/jstests/core/geo_s2twofields.js
@@ -1,7 +1,7 @@
// Verify that we can index multiple geo fields with 2dsphere, and that
// performance is what we expect it to be with indexing both fields.
-var t = db.geo_s2twofields
-t.drop()
+var t = db.geo_s2twofields;
+t.drop();
Random.setRandomSeed();
var random = Random.rand;
diff --git a/jstests/core/geo_s2within.js b/jstests/core/geo_s2within.js
index 87fd32a7676..77a9ed9ed3e 100644
--- a/jstests/core/geo_s2within.js
+++ b/jstests/core/geo_s2within.js
@@ -1,36 +1,36 @@
// Test some cases that might be iffy with $within, mostly related to polygon w/holes.
-t = db.geo_s2within
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t = db.geo_s2within;
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
somepoly = { "type" : "Polygon",
- "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]}
+ "coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]};
-t.insert({geo: { "type" : "LineString", "coordinates": [ [ 40.1, 5.1], [40.2, 5.2]]}})
+t.insert({geo: { "type" : "LineString", "coordinates": [ [ 40.1, 5.1], [40.2, 5.2]]}});
// This is only partially contained within the polygon.
-t.insert({geo: { "type" : "LineString", "coordinates": [ [ 40.1, 5.1], [42, 7]]}})
+t.insert({geo: { "type" : "LineString", "coordinates": [ [ 40.1, 5.1], [42, 7]]}});
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
-t.drop()
-t.ensureIndex({geo: "2dsphere"})
+t.drop();
+t.ensureIndex({geo: "2dsphere"});
somepoly = { "type" : "Polygon",
"coordinates" : [ [ [40,5], [40,8], [43,8], [43,5], [40,5]],
- [ [41,6], [42,6], [42,7], [41,7], [41,6]]]}
+ [ [41,6], [42,6], [42,7], [41,7], [41,6]]]};
-t.insert({geo:{ "type" : "Point", "coordinates": [ 40, 5 ] }})
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+t.insert({geo:{ "type" : "Point", "coordinates": [ 40, 5 ] }});
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
// In the hole. Shouldn't find it.
-t.insert({geo:{ "type" : "Point", "coordinates": [ 41.1, 6.1 ] }})
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+t.insert({geo:{ "type" : "Point", "coordinates": [ 41.1, 6.1 ] }});
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
// Also in the hole.
-t.insert({geo: { "type" : "LineString", "coordinates": [ [ 41.1, 6.1], [41.2, 6.2]]}})
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+t.insert({geo: { "type" : "LineString", "coordinates": [ [ 41.1, 6.1], [41.2, 6.2]]}});
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
// Half-hole, half-not. Shouldn't be $within.
-t.insert({geo: { "type" : "LineString", "coordinates": [ [ 41.5, 6.5], [42.5, 7.5]]}})
-res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } })
+t.insert({geo: { "type" : "LineString", "coordinates": [ [ 41.5, 6.5], [42.5, 7.5]]}});
+res = t.find({ "geo" : { "$within" : { "$geometry" : somepoly} } });
assert.eq(res.itcount(), 1);
diff --git a/jstests/core/geo_sort1.js b/jstests/core/geo_sort1.js
index 67de80e65c7..cd07345b587 100644
--- a/jstests/core/geo_sort1.js
+++ b/jstests/core/geo_sort1.js
@@ -1,5 +1,5 @@
-t = db.geo_sort1
+t = db.geo_sort1;
t.drop();
for ( x=0; x<10; x++ ){
@@ -8,10 +8,10 @@ for ( x=0; x<10; x++ ){
}
}
-t.ensureIndex( { loc : "2d" , foo : 1 } )
+t.ensureIndex( { loc : "2d" , foo : 1 } );
-q = t.find( { loc : { $near : [ 5 , 5 ] } , foo : { $gt : 20 } } )
-m = function(z){ return z.foo; }
+q = t.find( { loc : { $near : [ 5 , 5 ] } , foo : { $gt : 20 } } );
+m = function(z){ return z.foo; };
a = q.clone().map( m );
b = q.clone().sort( { foo : 1 } ).map( m );
diff --git a/jstests/core/geo_uniqueDocs.js b/jstests/core/geo_uniqueDocs.js
index 61f1a40522d..23297bb1ec9 100644
--- a/jstests/core/geo_uniqueDocs.js
+++ b/jstests/core/geo_uniqueDocs.js
@@ -1,40 +1,40 @@
// Test uniqueDocs option for $within and geoNear queries SERVER-3139
// SERVER-12120 uniqueDocs is deprecated. Server always returns unique documents.
-collName = 'geo_uniqueDocs_test'
-t = db.geo_uniqueDocs_test
-t.drop()
+collName = 'geo_uniqueDocs_test';
+t = db.geo_uniqueDocs_test;
+t.drop();
-t.save( { locs : [ [0,2], [3,4]] } )
-t.save( { locs : [ [6,8], [10,10] ] } )
+t.save( { locs : [ [0,2], [3,4]] } );
+t.save( { locs : [ [6,8], [10,10] ] } );
-t.ensureIndex( { locs : '2d' } )
+t.ensureIndex( { locs : '2d' } );
// geoNear tests
// uniqueDocs option is ignored.
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0]}).results.length)
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:false}).results.length)
-assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:true}).results.length)
-results = db.runCommand({geoNear:collName, near:[0,0], num:2}).results
-assert.eq(2, results.length)
-assert.close(2, results[0].dis)
-assert.close(10, results[1].dis)
-results = db.runCommand({geoNear:collName, near:[0,0], num:2, uniqueDocs:true}).results
-assert.eq(2, results.length)
-assert.close(2, results[0].dis)
-assert.close(10, results[1].dis)
+assert.eq(2, db.runCommand({geoNear:collName, near:[0,0]}).results.length);
+assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:false}).results.length);
+assert.eq(2, db.runCommand({geoNear:collName, near:[0,0], uniqueDocs:true}).results.length);
+results = db.runCommand({geoNear:collName, near:[0,0], num:2}).results;
+assert.eq(2, results.length);
+assert.close(2, results[0].dis);
+assert.close(10, results[1].dis);
+results = db.runCommand({geoNear:collName, near:[0,0], num:2, uniqueDocs:true}).results;
+assert.eq(2, results.length);
+assert.close(2, results[0].dis);
+assert.close(10, results[1].dis);
// $within tests
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]]}}}).itcount())
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : true}}}).itcount())
-assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : false}}}).itcount())
+assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]]}}}).itcount());
+assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : true}}}).itcount());
+assert.eq(2, t.find( {locs: {$within: {$box : [[0,0],[9,9]], $uniqueDocs : false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : true}}}).itcount())
-assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : false}}}).itcount())
+assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : true}}}).itcount());
+assert.eq(2, t.find( {locs: {$within: {$center : [[5,5],7], $uniqueDocs : false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : true}}}).itcount())
-assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : false}}}).itcount())
+assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : true}}}).itcount());
+assert.eq(2, t.find( {locs: {$within: {$centerSphere : [[5,5],1], $uniqueDocs : false}}}).itcount());
-assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : true}}}).itcount())
-assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : false}}}).itcount())
+assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : true}}}).itcount());
+assert.eq(2, t.find( {locs: {$within: {$polygon : [[0,0],[0,9],[9,9]], $uniqueDocs : false}}}).itcount());
diff --git a/jstests/core/geo_uniqueDocs2.js b/jstests/core/geo_uniqueDocs2.js
index f9b95113f78..62a27d606e3 100644
--- a/jstests/core/geo_uniqueDocs2.js
+++ b/jstests/core/geo_uniqueDocs2.js
@@ -64,7 +64,7 @@ arrLocs = [[20,30],[40,50]];
t.save( {loc:arrLocs} );
results = db.runCommand( { geoNear : collName , near : [50,50], num : 10, uniqueDocs : false, includeLocs : true } ).results;
// The original loc arrays are returned as objects.
-expectedLocs = arrLocs
+expectedLocs = arrLocs;
assert.contains( results[0].loc, expectedLocs );
diff --git a/jstests/core/geo_update.js b/jstests/core/geo_update.js
index dd4b28c8374..34305559039 100644
--- a/jstests/core/geo_update.js
+++ b/jstests/core/geo_update.js
@@ -1,37 +1,37 @@
// Tests geo queries w/ update & upsert
// from SERVER-3428
-var coll = db.testGeoUpdate
-coll.drop()
+var coll = db.testGeoUpdate;
+coll.drop();
-coll.ensureIndex({ loc : "2d" })
+coll.ensureIndex({ loc : "2d" });
// Test normal update
-print( "Updating..." )
+print( "Updating..." );
-coll.insert({ loc : [1.0, 2.0] })
+coll.insert({ loc : [1.0, 2.0] });
coll.update({ loc : { $near : [1.0, 2.0] } },
- { x : true, loc : [1.0, 2.0] })
+ { x : true, loc : [1.0, 2.0] });
// Test upsert
-print( "Upserting..." )
+print( "Upserting..." );
coll.update({ loc : { $within : { $center : [[10, 20], 1] } } },
{ x : true },
- true)
+ true);
coll.update({ loc : { $near : [10.0, 20.0], $maxDistance : 1 } },
{ x : true },
- true)
+ true);
coll.update({ loc : { $near : [100, 100], $maxDistance : 1 } },
{ $set : { loc : [100, 100] }, $push : { people : "chris" } },
- true)
+ true);
coll.update({ loc : { $near : [100, 100], $maxDistance : 1 } },
{ $set : { loc : [100, 100] }, $push : { people : "john" } },
- true)
+ true);
-assert.eq( 4, coll.find().itcount() )
+assert.eq( 4, coll.find().itcount() );
diff --git a/jstests/core/geo_update1.js b/jstests/core/geo_update1.js
index 6352ef0aa19..c3d2623d3de 100644
--- a/jstests/core/geo_update1.js
+++ b/jstests/core/geo_update1.js
@@ -1,6 +1,6 @@
-t = db.geo_update1
-t.drop()
+t = db.geo_update1;
+t.drop();
for(var x = 0; x < 10; x++ ) {
for(var y = 0; y < 10; y++ ) {
@@ -8,29 +8,29 @@ for(var x = 0; x < 10; x++ ) {
}
}
-t.ensureIndex( { loc : "2d" } )
+t.ensureIndex( { loc : "2d" } );
function p(){
print( "--------------" );
for ( var y=0; y<10; y++ ){
- var c = t.find( { y : y } ).sort( { x : 1 } )
+ var c = t.find( { y : y } ).sort( { x : 1 } );
var s = "";
while ( c.hasNext() )
s += c.next().z + " ";
- print( s )
+ print( s );
}
print( "--------------" );
}
-p()
+p();
var res = t.update({ loc: { $within: { $center: [[ 5, 5 ], 2 ]}}}, { $inc: { z: 1 }}, false, true);
assert.writeOK( res );
-p()
+p();
assert.writeOK(t.update({}, {'$inc' : { 'z' : 1}}, false, true));
-p()
+p();
res = t.update({ loc: { $within: { $center: [[ 5, 5 ], 2 ]}}}, { $inc: { z: 1 }}, false, true);
assert.writeOK( res );
-p()
+p();
diff --git a/jstests/core/geo_update2.js b/jstests/core/geo_update2.js
index 6a42619ac98..f2f1b6cee4b 100644
--- a/jstests/core/geo_update2.js
+++ b/jstests/core/geo_update2.js
@@ -1,6 +1,6 @@
-t = db.geo_update2
-t.drop()
+t = db.geo_update2;
+t.drop();
for(var x = 0; x < 10; x++ ) {
for(var y = 0; y < 10; y++ ) {
@@ -8,32 +8,32 @@ for(var x = 0; x < 10; x++ ) {
}
}
-t.ensureIndex( { loc : "2d" } )
+t.ensureIndex( { loc : "2d" } );
function p(){
print( "--------------" );
for ( var y=0; y<10; y++ ){
- var c = t.find( { y : y } ).sort( { x : 1 } )
+ var c = t.find( { y : y } ).sort( { x : 1 } );
var s = "";
while ( c.hasNext() )
s += c.next().z + " ";
- print( s )
+ print( s );
}
print( "--------------" );
}
-p()
+p();
assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
{'$inc' : { 'z' : 1}}, false, true));
-p()
+p();
assert.writeOK(t.update({}, {'$inc' : { 'z' : 1}}, false, true));
-p()
+p();
assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
{'$inc' : { 'z' : 1}}, false, true));
-p()
+p();
diff --git a/jstests/core/geo_update_btree.js b/jstests/core/geo_update_btree.js
index 3577a9ff7b6..12a10c736b8 100644
--- a/jstests/core/geo_update_btree.js
+++ b/jstests/core/geo_update_btree.js
@@ -1,11 +1,11 @@
// Tests whether the geospatial search is stable under btree updates
-var coll = db.getCollection( "jstests_geo_update_btree" )
-coll.drop()
+var coll = db.getCollection( "jstests_geo_update_btree" );
+coll.drop();
-coll.ensureIndex( { loc : '2d' } )
+coll.ensureIndex( { loc : '2d' } );
-var big = new Array( 3000 ).toString()
+var big = new Array( 3000 ).toString();
if (testingReplication) {
coll.setWriteConcern({ w: 2 });
@@ -23,7 +23,7 @@ var parallelInsert = startParallelShell(
for ( i = 0; i < 1000; i++ ) {
coll.update(
{ loc : { $within : { $center : [ [ Random.rand() * 180, Random.rand() * 180 ], Random.rand() * 50 ] } } },
- { $set : { v : big } }, false, true )
+ { $set : { v : big } }, false, true );
if( i % 10 == 0 ) print( i );
}
diff --git a/jstests/core/geo_update_btree2.js b/jstests/core/geo_update_btree2.js
index e0ddfd2adaa..b4ec059166a 100644
--- a/jstests/core/geo_update_btree2.js
+++ b/jstests/core/geo_update_btree2.js
@@ -14,53 +14,53 @@
assert.commandWorked( db._adminCommand( { setParameter:1, notablescan:true } ) );
var status = function( msg ){
- print( "\n\n###\n" + msg + "\n###\n\n" )
-}
+ print( "\n\n###\n" + msg + "\n###\n\n" );
+};
-var coll = db.getCollection( "jstests_geo_update_btree2" )
-coll.drop()
+var coll = db.getCollection( "jstests_geo_update_btree2" );
+coll.drop();
-coll.ensureIndex( { loc : '2d' } )
+coll.ensureIndex( { loc : '2d' } );
-status( "Inserting points..." )
+status( "Inserting points..." );
-var numPoints = 10
+var numPoints = 10;
Random.setRandomSeed();
for ( i = 0; i < numPoints; i++ ) {
coll.insert( { _id : i, loc : [ Random.rand() * 180, Random.rand() * 180 ], i : i % 2 } );
}
-status( "Starting long query..." )
+status( "Starting long query..." );
-var query = coll.find({ loc : { $within : { $box : [[-180, -180], [180, 180]] } } }).batchSize( 2 )
-var firstValues = [ query.next()._id, query.next()._id ]
-printjson( firstValues )
+var query = coll.find({ loc : { $within : { $box : [[-180, -180], [180, 180]] } } }).batchSize( 2 );
+var firstValues = [ query.next()._id, query.next()._id ];
+printjson( firstValues );
-status( "Removing points not returned by query..." )
+status( "Removing points not returned by query..." );
-var allQuery = coll.find()
-var removeIds = []
+var allQuery = coll.find();
+var removeIds = [];
while( allQuery.hasNext() ){
- var id = allQuery.next()._id
+ var id = allQuery.next()._id;
if( firstValues.indexOf( id ) < 0 ){
- removeIds.push( id )
+ removeIds.push( id );
}
}
-var updateIds = []
-for( var i = 0, max = removeIds.length / 2; i < max; i++ ) updateIds.push( removeIds.pop() )
+var updateIds = [];
+for( var i = 0, max = removeIds.length / 2; i < max; i++ ) updateIds.push( removeIds.pop() );
-printjson( removeIds )
-coll.remove({ _id : { $in : removeIds } })
+printjson( removeIds );
+coll.remove({ _id : { $in : removeIds } });
-status( "Updating points returned by query..." )
+status( "Updating points returned by query..." );
printjson(updateIds);
-var big = new Array( 3000 ).toString()
+var big = new Array( 3000 ).toString();
for( var i = 0; i < updateIds.length; i++ )
- coll.update({ _id : updateIds[i] }, { $set : { data : big } })
+ coll.update({ _id : updateIds[i] }, { $set : { data : big } });
-status( "Counting final points..." )
+status( "Counting final points..." );
// It's not defined whether or not we return documents that are modified during a query. We
// shouldn't crash, but it's not defined how many results we get back. This test is modifying every
diff --git a/jstests/core/geo_update_dedup.js b/jstests/core/geo_update_dedup.js
index def93a839e4..3011c5c9cfe 100644
--- a/jstests/core/geo_update_dedup.js
+++ b/jstests/core/geo_update_dedup.js
@@ -2,7 +2,7 @@
// the same document multiple times only apply
// the update once
-var t = db.jstests_geo_update_dedup;;
+var t = db.jstests_geo_update_dedup;
// 2d index with $near
t.drop();
@@ -36,8 +36,8 @@ assert.eq(1, t.findOne().touchCount);
t.drop();
t.ensureIndex({geo: "2dsphere"});
var x = { "type" : "Polygon",
- "coordinates" : [[[49.999,49.999], [50.0,50.0], [50.001,50.001], [49.999,49.999]]]}
-t.save({geo: x})
+ "coordinates" : [[[49.999,49.999], [50.0,50.0], [50.001,50.001], [49.999,49.999]]]};
+t.save({geo: x});
res = t.update({geo: {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
{$inc: {touchCount: 1}}, false, true);
@@ -50,7 +50,7 @@ var locdata = [
{geo: {type: "Point", coordinates: [50.000,50.000]}},
{geo: {type: "Point", coordinates: [50.001,50.001]}}
];
-t.save({locdata: locdata, count: 0})
+t.save({locdata: locdata, count: 0});
t.ensureIndex({"locdata.geo": "2dsphere"});
res = t.update({"locdata.geo": {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
diff --git a/jstests/core/geo_withinquery.js b/jstests/core/geo_withinquery.js
index 11701d34c62..d60116c8838 100644
--- a/jstests/core/geo_withinquery.js
+++ b/jstests/core/geo_withinquery.js
@@ -5,11 +5,11 @@ t.drop();
num = 0;
for ( x=0; x<=20; x++ ){
for ( y=0; y<=20; y++ ){
- o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ o = { _id : num++ , loc : [ x , y ] };
+ t.save( o );
}
}
assert.eq(21 * 21 - 1, t.find({ $and: [ {loc: {$ne:[0,0]}},
{loc: {$within: {$box: [[0,0], [100,100]]}}},
- ]}).itcount(), "UHOH!")
+ ]}).itcount(), "UHOH!");
diff --git a/jstests/core/geoa.js b/jstests/core/geoa.js
index 3081f6c5c2e..036a5630550 100644
--- a/jstests/core/geoa.js
+++ b/jstests/core/geoa.js
@@ -1,10 +1,10 @@
-t = db.geoa
+t = db.geoa;
t.drop();
-t.save( { _id : 1 , a : { loc : [ 5 , 5 ] } } )
-t.save( { _id : 2 , a : { loc : [ 6 , 6 ] } } )
-t.save( { _id : 3 , a : { loc : [ 7 , 7 ] } } )
+t.save( { _id : 1 , a : { loc : [ 5 , 5 ] } } );
+t.save( { _id : 2 , a : { loc : [ 6 , 6 ] } } );
+t.save( { _id : 3 , a : { loc : [ 7 , 7 ] } } );
t.ensureIndex( { "a.loc" : "2d" } );
diff --git a/jstests/core/geoc.js b/jstests/core/geoc.js
index 8b0178095e8..138b86c65c5 100644
--- a/jstests/core/geoc.js
+++ b/jstests/core/geoc.js
@@ -1,14 +1,14 @@
t = db.geoc;
-t.drop()
+t.drop();
N = 1000;
-for (var i=0; i<N; i++) t.insert({loc:[100+Math.random(), 100+Math.random()], z:0})
-for (var i=0; i<N; i++) t.insert({loc:[0+Math.random(), 0+Math.random()], z:1})
-for (var i=0; i<N; i++) t.insert({loc:[-100+Math.random(), -100+Math.random()], z:2})
+for (var i=0; i<N; i++) t.insert({loc:[100+Math.random(), 100+Math.random()], z:0});
+for (var i=0; i<N; i++) t.insert({loc:[0+Math.random(), 0+Math.random()], z:1});
+for (var i=0; i<N; i++) t.insert({loc:[-100+Math.random(), -100+Math.random()], z:2});
-t.ensureIndex({loc:'2d'})
+t.ensureIndex({loc:'2d'});
function test( z , l ){
assert.lt( 0 , t.find({loc:{$near:[100,100]}, z:z}).limit(l).itcount() , "z: " + z + " l: " + l );
diff --git a/jstests/core/geod.js b/jstests/core/geod.js
index 6e458454a71..118f5021381 100644
--- a/jstests/core/geod.js
+++ b/jstests/core/geod.js
@@ -1,14 +1,14 @@
var t=db.geod;
-t.drop()
-t.save( { loc: [0,0] } )
-t.save( { loc: [0.5,0] } )
-t.ensureIndex({loc:"2d"})
+t.drop();
+t.save( { loc: [0,0] } );
+t.save( { loc: [0.5,0] } );
+t.ensureIndex({loc:"2d"});
// do a few geoNears with different maxDistances. The first iteration
// should match no points in the dataset.
-dists = [.49, .51, 1.0]
+dists = [.49, .51, 1.0];
for (idx in dists){
b=db.runCommand({geoNear:"geod", near:[1,0], num:2, maxDistance:dists[idx]});
assert.eq(b.errmsg, undefined, "A"+idx);
- l=b.results.length
- assert.eq(l, idx, "B"+idx)
+ l=b.results.length;
+ assert.eq(l, idx, "B"+idx);
}
diff --git a/jstests/core/geof.js b/jstests/core/geof.js
index 786ead6a94a..718c6e6593d 100644
--- a/jstests/core/geof.js
+++ b/jstests/core/geof.js
@@ -1,17 +1,17 @@
-t = db.geof
+t = db.geof;
t.drop();
// corners (dist ~0.98)
-t.insert({loc: [ 0.7, 0.7]})
-t.insert({loc: [ 0.7, -0.7]})
-t.insert({loc: [-0.7, 0.7]})
-t.insert({loc: [-0.7, -0.7]})
+t.insert({loc: [ 0.7, 0.7]});
+t.insert({loc: [ 0.7, -0.7]});
+t.insert({loc: [-0.7, 0.7]});
+t.insert({loc: [-0.7, -0.7]});
// on x axis (dist == 0.9)
-t.insert({loc: [-0.9, 0]})
-t.insert({loc: [-0.9, 0]})
+t.insert({loc: [-0.9, 0]});
+t.insert({loc: [-0.9, 0]});
-t.ensureIndex( { loc : "2d" } )
+t.ensureIndex( { loc : "2d" } );
t.find({loc: {$near: [0,0]}}).limit(2).forEach( function(o){
//printjson(o);
diff --git a/jstests/core/getlog1.js b/jstests/core/getlog1.js
index fa5c4884b3b..cf59b8f8318 100644
--- a/jstests/core/getlog1.js
+++ b/jstests/core/getlog1.js
@@ -9,16 +9,16 @@ contains = function(arr,obj) {
}
}
return false;
-}
+};
-var resp = db.adminCommand({getLog:"*"})
+var resp = db.adminCommand({getLog:"*"});
assert( resp.ok == 1, "error executing getLog command" );
assert( resp.names, "no names field" );
assert( resp.names.length > 0, "names array is empty" );
assert( contains(resp.names,"global") , "missing global category" );
assert( !contains(resp.names,"butty") , "missing butty category" );
-resp = db.adminCommand({getLog:"global"})
+resp = db.adminCommand({getLog:"global"});
assert( resp.ok == 1, "error executing getLog command" );
assert( resp.log, "no log field" );
assert( resp.log.length > 0 , "no log lines" );
diff --git a/jstests/core/getlog2.js b/jstests/core/getlog2.js
index 9edabb4ff19..9bd217d3844 100644
--- a/jstests/core/getlog2.js
+++ b/jstests/core/getlog2.js
@@ -1,7 +1,7 @@
// tests getlog as well as slow querying logging
glcol = db.getLogTest2;
-glcol.drop()
+glcol.drop();
contains = function(arr, func) {
var i = arr.length;
@@ -11,7 +11,7 @@ contains = function(arr, func) {
}
}
return false;
-}
+};
// test doesn't work when talking to mongos
if(db.isMaster().msg != "isdbgrid") {
diff --git a/jstests/core/group1.js b/jstests/core/group1.js
index 2539037c210..f59442cc6d7 100644
--- a/jstests/core/group1.js
+++ b/jstests/core/group1.js
@@ -26,7 +26,7 @@ ret = t.groupcmd( { key : {} , reduce : p.reduce , initial : p.initial } );
assert.eq( 1 , ret.length , "ZZ 2" );
assert.eq( 5 , ret[0].count , "ZZ 3" );
-ret = t.groupcmd( { key : {} , reduce : function(obj,prev){ prev.sum += obj.n } , initial : { sum : 0 } } );
+ret = t.groupcmd( { key : {} , reduce : function(obj,prev){ prev.sum += obj.n; } , initial : { sum : 0 } } );
assert.eq( 1 , ret.length , "ZZ 4" );
assert.eq( 15 , ret[0].sum , "ZZ 5" );
@@ -56,10 +56,10 @@ p = { key : { 'name.first' : true } ,
res = t.group( p );
assert.eq( 2 , res.length , "Z1" );
-assert.eq( "a" , res[0]['name.first'] , "Z2" )
-assert.eq( "b" , res[1]['name.first'] , "Z3" )
-assert.eq( 2 , res[0].count , "Z4" )
-assert.eq( 1 , res[1].count , "Z5" )
+assert.eq( "a" , res[0]['name.first'] , "Z2" );
+assert.eq( "b" , res[1]['name.first'] , "Z3" );
+assert.eq( 2 , res[0].count , "Z4" );
+assert.eq( 1 , res[1].count , "Z5" );
// SERVER-15851 Test invalid user input.
p = {
@@ -78,7 +78,7 @@ p = {
key: {"name.first": true},
$reduce: function(obj, prev){prev.count++;},
initial: {count: 0},
- finalize: function(obj){ob}
+ finalize: function(obj){ob;}
};
assert.commandFailedWithCode(db.runCommand({group: p}),
ErrorCodes.JSInterpreterFailure,
@@ -89,7 +89,7 @@ p = {
$keyf: "a" ,
$reduce: function(obj, prev){prev.count++;},
initial: {count: 0},
- finalize: function(obj){ob}
+ finalize: function(obj){ob;}
};
assert.commandFailedWithCode(db.runCommand({group: p}),
ErrorCodes.JSInterpreterFailure,
diff --git a/jstests/core/group2.js b/jstests/core/group2.js
index c29f8459adb..b5566bce2c7 100644
--- a/jstests/core/group2.js
+++ b/jstests/core/group2.js
@@ -27,14 +27,14 @@ var keyFn = function(x) {
return { a: 'a' in x ? x.a : null };
};
-delete cmd.key
+delete cmd.key;
cmd["$keyf"] = keyFn;
result2 = t.group( cmd );
assert.eq( result , result2, "check result2" );
-delete cmd.$keyf
+delete cmd.$keyf;
cmd["keyf"] = keyFn;
result3 = t.group( cmd );
diff --git a/jstests/core/group4.js b/jstests/core/group4.js
index e75c0d1ae2c..788d55c7962 100644
--- a/jstests/core/group4.js
+++ b/jstests/core/group4.js
@@ -1,5 +1,5 @@
-t = db.group4
+t = db.group4;
t.drop();
function test( c , n ){
@@ -11,20 +11,20 @@ function test( c , n ){
);
}
-t.insert({name:'bob',foo:1})
-t.insert({name:'bob',foo:2})
-t.insert({name:'alice',foo:1})
-t.insert({name:'alice',foo:3})
-t.insert({name:'fred',foo:3})
-t.insert({name:'fred',foo:4})
+t.insert({name:'bob',foo:1});
+t.insert({name:'bob',foo:2});
+t.insert({name:'alice',foo:1});
+t.insert({name:'alice',foo:3});
+t.insert({name:'fred',foo:3});
+t.insert({name:'fred',foo:4});
x = t.group(
{
key: {foo:1},
initial: {count:0,values:[]},
reduce: function (obj, prev){
- prev.count++
- prev.values.push(obj.name)
+ prev.count++;
+ prev.values.push(obj.name);
}
}
);
diff --git a/jstests/core/group5.js b/jstests/core/group5.js
index 3534fe5f030..5d13297bd4d 100644
--- a/jstests/core/group5.js
+++ b/jstests/core/group5.js
@@ -5,7 +5,7 @@ t.drop();
// each group has groupnum+1 5 users
for ( var group=0; group<10; group++ ){
for ( var i=0; i<5+group; i++ ){
- t.save( { group : "group" + group , user : i } )
+ t.save( { group : "group" + group , user : i } );
}
}
diff --git a/jstests/core/grow_hash_table.js b/jstests/core/grow_hash_table.js
index 1f96820d61f..0c782444a2d 100644
--- a/jstests/core/grow_hash_table.js
+++ b/jstests/core/grow_hash_table.js
@@ -37,6 +37,6 @@ var doTest = function(count) {
}
testDB.dropDatabase();
jsTest.log('Test PASSED');
-}
+};
doTest(10000);
diff --git a/jstests/core/hashindex1.js b/jstests/core/hashindex1.js
index dcb75dafaf1..449f5520b84 100644
--- a/jstests/core/hashindex1.js
+++ b/jstests/core/hashindex1.js
@@ -1,5 +1,5 @@
var t = db.hashindex1;
-t.drop()
+t.drop();
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
diff --git a/jstests/core/id1.js b/jstests/core/id1.js
index 9236340e4ec..7c40f206851 100644
--- a/jstests/core/id1.js
+++ b/jstests/core/id1.js
@@ -1,5 +1,5 @@
-t = db.id1
+t = db.id1;
t.drop();
t.save( { _id : { a : 1 , b : 2 } , x : "a" } );
diff --git a/jstests/core/idhack.js b/jstests/core/idhack.js
index 1b24fb933f6..b6f1c5fc4de 100644
--- a/jstests/core/idhack.js
+++ b/jstests/core/idhack.js
@@ -1,28 +1,28 @@
-t = db.idhack
-t.drop()
+t = db.idhack;
+t.drop();
// Include helpers for analyzing explain output.
load("jstests/libs/analyze_plan.js");
-t.insert( { _id : { x : 1 } , z : 1 } )
-t.insert( { _id : { x : 2 } , z : 2 } )
-t.insert( { _id : { x : 3 } , z : 3 } )
-t.insert( { _id : 1 , z : 4 } )
-t.insert( { _id : 2 , z : 5 } )
-t.insert( { _id : 3 , z : 6 } )
+t.insert( { _id : { x : 1 } , z : 1 } );
+t.insert( { _id : { x : 2 } , z : 2 } );
+t.insert( { _id : { x : 3 } , z : 3 } );
+t.insert( { _id : 1 , z : 4 } );
+t.insert( { _id : 2 , z : 5 } );
+t.insert( { _id : 3 , z : 6 } );
-assert.eq( 2 , t.findOne( { _id : { x : 2 } } ).z , "A1" )
-assert.eq( 2 , t.find( { _id : { $gte : 2 } } ).count() , "A2" )
-assert.eq( 2 , t.find( { _id : { $gte : 2 } } ).itcount() , "A3" )
+assert.eq( 2 , t.findOne( { _id : { x : 2 } } ).z , "A1" );
+assert.eq( 2 , t.find( { _id : { $gte : 2 } } ).count() , "A2" );
+assert.eq( 2 , t.find( { _id : { $gte : 2 } } ).itcount() , "A3" );
-t.update( { _id : { x : 2 } } , { $set : { z : 7 } } )
-assert.eq( 7 , t.findOne( { _id : { x : 2 } } ).z , "B1" )
+t.update( { _id : { x : 2 } } , { $set : { z : 7 } } );
+assert.eq( 7 , t.findOne( { _id : { x : 2 } } ).z , "B1" );
-t.update( { _id : { $gte : 2 } } , { $set : { z : 8 } } , false , true )
-assert.eq( 4 , t.findOne( { _id : 1 } ).z , "C1" )
-assert.eq( 8 , t.findOne( { _id : 2 } ).z , "C2" )
-assert.eq( 8 , t.findOne( { _id : 3 } ).z , "C3" )
+t.update( { _id : { $gte : 2 } } , { $set : { z : 8 } } , false , true );
+assert.eq( 4 , t.findOne( { _id : 1 } ).z , "C1" );
+assert.eq( 8 , t.findOne( { _id : 2 } ).z , "C2" );
+assert.eq( 8 , t.findOne( { _id : 3 } ).z , "C3" );
// explain output should show that the ID hack was applied.
var query = { _id : { x : 2 } };
diff --git a/jstests/core/in5.js b/jstests/core/in5.js
index 435c8864004..a966a6a187c 100644
--- a/jstests/core/in5.js
+++ b/jstests/core/in5.js
@@ -1,5 +1,5 @@
-t = db.in5
+t = db.in5;
function go( fn ){
t.drop();
@@ -13,44 +13,44 @@ function go( fn ){
y = {};
- y[fn] = { $in : [ { a : 1 , b : 2 } ] }
+ y[fn] = { $in : [ { a : 1 , b : 2 } ] };
assert.eq( 1 , t.find( y ).itcount() , "A2 - " + fn );
z = {};
z[fn+".a"] = 1;
- z[fn+".b"] = { $in : [ 2 ] }
+ z[fn+".b"] = { $in : [ 2 ] };
assert.eq( 1 , t.find( z ).itcount() , "A3 - " + fn ); // SERVER-1366
- i = {}
- i[fn] = 1
- t.ensureIndex( i )
+ i = {};
+ i[fn] = 1;
+ t.ensureIndex( i );
assert.eq( 1 , t.find( x ).itcount() , "B1 - " + fn );
assert.eq( 1 , t.find( y ).itcount() , "B2 - " + fn );
assert.eq( 1 , t.find( z ).itcount() , "B3 - " + fn ); // SERVER-1366
- t.dropIndex( i )
+ t.dropIndex( i );
assert.eq( 1 , t.getIndexes().length , "T2" );
- i = {}
+ i = {};
i[fn + ".a" ] = 1;
- t.ensureIndex( i )
+ t.ensureIndex( i );
assert.eq( 2 , t.getIndexes().length , "T3" );
assert.eq( 1 , t.find( x ).itcount() , "C1 - " + fn );
assert.eq( 1 , t.find( y ).itcount() , "C2 - " + fn );
assert.eq( 1 , t.find( z ).itcount() , "C3 - " + fn ); // SERVER-1366
- t.dropIndex( i )
+ t.dropIndex( i );
}
go( "x" );
-go( "_id" )
+go( "_id" );
diff --git a/jstests/core/inc-SERVER-7446.js b/jstests/core/inc-SERVER-7446.js
index c8066a8e491..6f365e1f5e2 100644
--- a/jstests/core/inc-SERVER-7446.js
+++ b/jstests/core/inc-SERVER-7446.js
@@ -1,4 +1,4 @@
-var c = db.incSERVER7446
+var c = db.incSERVER7446;
// A 32 bit overflow spills to 64 bits
c.drop();
@@ -36,4 +36,4 @@ updateResult = c.update( {}, { $inc:{ a:NumberInt( -1 ) } } );
assert.eq(0, updateResult.nMatched,
"Did not fail to decrement a NumberLong past std::numeric_limits<int64_t>::min()");
-c.drop()
+c.drop();
diff --git a/jstests/core/inc2.js b/jstests/core/inc2.js
index 75a8e65a384..3bcc5146f75 100644
--- a/jstests/core/inc2.js
+++ b/jstests/core/inc2.js
@@ -1,5 +1,5 @@
-t = db.inc2
+t = db.inc2;
t.drop();
t.save( { _id : 1 , x : 1 } );
diff --git a/jstests/core/inc3.js b/jstests/core/inc3.js
index baeeb198cf4..6f10ad2b27b 100644
--- a/jstests/core/inc3.js
+++ b/jstests/core/inc3.js
@@ -5,12 +5,12 @@ t.drop();
t.save( { _id : 1 , z : 1 , a : 1 } );
t.update( {} , { $inc : { z : 1 , a : 1 } } );
t.update( {} , { $inc : { a : 1 , z : 1 } } );
-assert.eq( { _id : 1 , z : 3 , a : 3 } , t.findOne() , "A" )
+assert.eq( { _id : 1 , z : 3 , a : 3 } , t.findOne() , "A" );
t.drop();
t.save( { _id : 1 , a : 1 , z : 1 } );
t.update( {} , { $inc : { z : 1 , a : 1 } } );
t.update( {} , { $inc : { a : 1 , z : 1 } } );
-assert.eq( { _id : 1 , a : 3 , z : 3 } , t.findOne() , "B" )
+assert.eq( { _id : 1 , a : 3 , z : 3 } , t.findOne() , "B" );
diff --git a/jstests/core/index13.js b/jstests/core/index13.js
index 7e317d90d94..21105166037 100644
--- a/jstests/core/index13.js
+++ b/jstests/core/index13.js
@@ -74,7 +74,7 @@ assertResults( { 'a.b': 1, 'a.c' : 1, 'd': { $elemMatch:{ e:1, f:1 } } } );
// Cases with nested $elemMatch.
-t.remove({})
+t.remove({});
index = { 'a.b.c':1, 'a.b.d' :1 };
t.ensureIndex( index );
t.insert( { a:[ { b: [ { c : 1, d : 1 } ] } ] } ) ;
@@ -115,7 +115,7 @@ assertResults( { 'a.b':{ $elemMatch:{ x:1, y:1 } } } );
// Cases with double dotted index field names branching to different fields at each dot.
t.drop();
-index = { 'a.b.c':1, 'a.e.f':1, 'a.b.d':1, 'a.e.g':1 }
+index = { 'a.b.c':1, 'a.e.f':1, 'a.b.d':1, 'a.e.g':1 };
t.ensureIndex( index );
t.save( { a:{ b:{ c:1, d:1 }, e:{ f:1, g:1 } } } );
t.save( { a:[ { b:{ c:1 }, e:{ f:1 } }, { b:{ d:1 }, e:{ g:1 } } ] } );
@@ -138,7 +138,7 @@ assertResults( { 'a.b':{ $elemMatch:{ d:1 } },
// Cases with double dotted index field names branching to different fields at each dot, and the
// same field name strings after the second dot.
t.drop();
-index = { 'a.b.c':1, 'a.e.c':1, 'a.b.d':1, 'a.e.d':1 }
+index = { 'a.b.c':1, 'a.e.c':1, 'a.b.d':1, 'a.e.d':1 };
t.ensureIndex( index );
t.save( { a:[ { b:[ { c:1, d:1 } ] }, { e:[ { c:1, d:1 } ] } ] } );
assert.eq( 1, t.count() );
diff --git a/jstests/core/index8.js b/jstests/core/index8.js
index 946e008a0e2..7b41da5ce50 100644
--- a/jstests/core/index8.js
+++ b/jstests/core/index8.js
@@ -18,7 +18,7 @@ checkIndexes = function( num ) {
assert( indexes[ start + 1 ].unique , "B" + num + " " + tojson( indexes[start+1] ) );
assert( !indexes[ start + 2 ].unique , "C" + num );
assert.eq( "cIndex", indexes[ start + 2 ].name , "D" + num );
-}
+};
checkIndexes( 1 );
t.reIndex();
diff --git a/jstests/core/indexOtherNamespace.js b/jstests/core/indexOtherNamespace.js
index 9876fb841f9..a94cff5d51b 100644
--- a/jstests/core/indexOtherNamespace.js
+++ b/jstests/core/indexOtherNamespace.js
@@ -6,7 +6,7 @@ load("jstests/libs/analyze_plan.js");
var otherDB = db.getSiblingDB("indexOtherNS");
otherDB.dropDatabase();
-otherDB.foo.insert({a:1})
+otherDB.foo.insert({a:1});
assert.eq(1, otherDB.foo.getIndexes().length);
assert(isCollscan(otherDB.foo.find({a:1}).explain().queryPlanner.winningPlan));
diff --git a/jstests/core/index_arr1.js b/jstests/core/index_arr1.js
index 815c01ec0d3..0878e19aa22 100644
--- a/jstests/core/index_arr1.js
+++ b/jstests/core/index_arr1.js
@@ -1,17 +1,17 @@
-t = db.index_arr1
-t.drop()
+t = db.index_arr1;
+t.drop();
-t.insert( { _id : 1 , a : 5 , b : [ { x : 1 } ] } )
-t.insert( { _id : 2 , a : 5 , b : [] } )
-t.insert( { _id : 3 , a : 5 } )
+t.insert( { _id : 1 , a : 5 , b : [ { x : 1 } ] } );
+t.insert( { _id : 2 , a : 5 , b : [] } );
+t.insert( { _id : 3 , a : 5 } );
-assert.eq( 3 , t.find( { a : 5 } ).itcount() , "A1" )
+assert.eq( 3 , t.find( { a : 5 } ).itcount() , "A1" );
-t.ensureIndex( { a : 1 , "b.x" : 1 } )
+t.ensureIndex( { a : 1 , "b.x" : 1 } );
assert.eq( 3 , t.find( { a : 5 } ).itcount() , "A2" ); // SERVER-1082
-assert.eq( 2 , t.getIndexes().length , "B1" )
-t.insert( { _id : 4 , a : 5 , b : [] } )
-t.ensureIndex( { a : 1 , "b.a" : 1 , "b.c" : 1 } )
-assert.eq( 3 , t.getIndexes().length , "B2" )
+assert.eq( 2 , t.getIndexes().length , "B1" );
+t.insert( { _id : 4 , a : 5 , b : [] } );
+t.ensureIndex( { a : 1 , "b.a" : 1 , "b.c" : 1 } );
+assert.eq( 3 , t.getIndexes().length , "B2" );
diff --git a/jstests/core/index_arr2.js b/jstests/core/index_arr2.js
index 101655f2ce9..78c480719dc 100644
--- a/jstests/core/index_arr2.js
+++ b/jstests/core/index_arr2.js
@@ -12,7 +12,7 @@ function test( withIndex ){
a : [
{ b : { c : 1 } }
]
- }
+ };
now = (new Date()).getTime() / 1000;
for (created = now - NUM; created <= now; created++ ) {
@@ -24,14 +24,14 @@ function test( withIndex ){
// change the last M items.
query = {
'created' : { '$gte' : now - M }
- }
+ };
Z = t.find( query ).count();
if ( withIndex ){
//t.ensureIndex( { 'a.b.c' : 1, 'created' : -1 } )
//t.ensureIndex( { created : -1 } )
- t.ensureIndex( { 'a.b.c' : 1 } , { name : "x" } )
+ t.ensureIndex( { 'a.b.c' : 1 } , { name : "x" } );
}
var res = t.update(query, { '$set' : { "a.0.b.c" : 0 } } , false , true );
@@ -45,7 +45,7 @@ function test( withIndex ){
assert.eq( Z , count , "count after withIndex:" + withIndex );
}
-test( false )
+test( false );
test( true );
diff --git a/jstests/core/index_big1.js b/jstests/core/index_big1.js
index dffebc351cf..eb4df5d5100 100644
--- a/jstests/core/index_big1.js
+++ b/jstests/core/index_big1.js
@@ -7,7 +7,7 @@ t.drop();
var s = "";
-t.ensureIndex( { a : 1 , x : 1 } )
+t.ensureIndex( { a : 1 , x : 1 } );
var bulk = t.initializeUnorderedBulkOp();
for ( i=0; i<N; i++ ) {
diff --git a/jstests/core/index_bigkeys.js b/jstests/core/index_bigkeys.js
index b0ea66d65f8..4b692ce1b19 100755
--- a/jstests/core/index_bigkeys.js
+++ b/jstests/core/index_bigkeys.js
@@ -1,7 +1,7 @@
t = db.bigkeysidxtest;
-var keys = []
+var keys = [];
var str = "aaaabbbbccccddddeeeeffffgggghhhh";
diff --git a/jstests/core/index_check2.js b/jstests/core/index_check2.js
index a4488dde229..8ebd13c850c 100644
--- a/jstests/core/index_check2.js
+++ b/jstests/core/index_check2.js
@@ -15,7 +15,7 @@ for ( var i=0; i<1000; i++ ){
q1 = { tags : "tag6" };
q2 = { tags : "tag12" };
-q3 = { tags : { $all : [ "tag6" , "tag12" ] } }
+q3 = { tags : { $all : [ "tag6" , "tag12" ] } };
assert.eq( 120 , t.find( q1 ).itcount() , "q1 a");
assert.eq( 120 , t.find( q2 ).itcount() , "q2 a" );
diff --git a/jstests/core/index_check5.js b/jstests/core/index_check5.js
index eabb929749f..f6b48448f63 100644
--- a/jstests/core/index_check5.js
+++ b/jstests/core/index_check5.js
@@ -1,5 +1,5 @@
-t = db.index_check5
+t = db.index_check5;
t.drop();
t.save( { "name" : "Player1" ,
diff --git a/jstests/core/index_check7.js b/jstests/core/index_check7.js
index 01a369a5300..f8020d76143 100644
--- a/jstests/core/index_check7.js
+++ b/jstests/core/index_check7.js
@@ -1,15 +1,15 @@
-t = db.index_check7
-t.drop()
+t = db.index_check7;
+t.drop();
for ( var i=0; i<100; i++ )
- t.save( { x : i } )
+ t.save( { x : i } );
-t.ensureIndex( { x : 1 } )
-assert.eq( 1 , t.find( { x : 27 } ).explain(true).executionStats.totalKeysExamined , "A" )
+t.ensureIndex( { x : 1 } );
+assert.eq( 1 , t.find( { x : 27 } ).explain(true).executionStats.totalKeysExamined , "A" );
-t.ensureIndex( { x : -1 } )
-assert.eq( 1 , t.find( { x : 27 } ).explain(true).executionStats.totalKeysExamined , "B" )
+t.ensureIndex( { x : -1 } );
+assert.eq( 1 , t.find( { x : 27 } ).explain(true).executionStats.totalKeysExamined , "B" );
assert.eq( 40 , t.find( { x : { $gt : 59 } } ).explain(true)
.executionStats.totalKeysExamined , "C" );
diff --git a/jstests/core/index_create_with_nul_in_name.js b/jstests/core/index_create_with_nul_in_name.js
index 6d6001dbdca..3c84460ddc4 100644
--- a/jstests/core/index_create_with_nul_in_name.js
+++ b/jstests/core/index_create_with_nul_in_name.js
@@ -11,4 +11,4 @@
var res = coll.runCommand('createIndexes', {indexes: [idx]});
assert.commandFailed(res, tojson(res));
assert.eq(res.code, 67); // CannotCreateIndex
-}())
+}());
diff --git a/jstests/core/index_diag.js b/jstests/core/index_diag.js
index 3651211009d..edb86e841e1 100644
--- a/jstests/core/index_diag.js
+++ b/jstests/core/index_diag.js
@@ -1,22 +1,22 @@
-t = db.index_diag
+t = db.index_diag;
t.drop();
t.ensureIndex( { x : 1 } );
-all = []
-ids = []
-xs = []
+all = [];
+ids = [];
+xs = [];
function r( a ){
- var n = []
+ var n = [];
for ( var x=a.length-1; x>=0; x-- )
n.push( a[x] );
return n;
}
for ( i=1; i<4; i++ ){
- o = { _id : i , x : -i }
+ o = { _id : i , x : -i };
t.insert( o );
all.push( o );
ids.push( { _id : i } );
@@ -29,16 +29,16 @@ assert.eq( r( all ) , t.find().sort( { _id : -1 } ).toArray() , "A2" );
assert.eq( all , t.find().sort( { x : -1 } ).toArray() , "A3" );
assert.eq( r( all ) , t.find().sort( { x : 1 } ).toArray() , "A4" );
-assert.eq( ids , t.find().sort( { _id : 1 } ).returnKey().toArray() , "B1" )
-assert.eq( r( ids ) , t.find().sort( { _id : -1 } ).returnKey().toArray() , "B2" )
-assert.eq( xs , t.find().sort( { x : -1 } ).returnKey().toArray() , "B3" )
-assert.eq( r( xs ) , t.find().sort( { x : 1 } ).returnKey().toArray() , "B4" )
+assert.eq( ids , t.find().sort( { _id : 1 } ).returnKey().toArray() , "B1" );
+assert.eq( r( ids ) , t.find().sort( { _id : -1 } ).returnKey().toArray() , "B2" );
+assert.eq( xs , t.find().sort( { x : -1 } ).returnKey().toArray() , "B3" );
+assert.eq( r( xs ) , t.find().sort( { x : 1 } ).returnKey().toArray() , "B4" );
-assert.eq( r( xs ) , t.find().hint( { x : 1 } ).returnKey().toArray() , "B4" )
+assert.eq( r( xs ) , t.find().hint( { x : 1 } ).returnKey().toArray() , "B4" );
// SERVER-4981
t.ensureIndex( { _id : 1 , x : 1 } );
-assert.eq( all , t.find().hint( { _id : 1 , x : 1 } ).returnKey().toArray() )
-assert.eq( r( all ) , t.find().hint( { _id : 1 , x : 1 } ).sort( { x : 1 } ).returnKey().toArray() )
+assert.eq( all , t.find().hint( { _id : 1 , x : 1 } ).returnKey().toArray() );
+assert.eq( r( all ) , t.find().hint( { _id : 1 , x : 1 } ).sort( { x : 1 } ).returnKey().toArray() );
-assert.eq( [ {} , {} , {} ], t.find().hint( { $natural : 1 } ).returnKey().toArray() )
+assert.eq( [ {} , {} , {} ], t.find().hint( { $natural : 1 } ).returnKey().toArray() );
diff --git a/jstests/core/index_elemmatch1.js b/jstests/core/index_elemmatch1.js
index 9641bb6cf0d..fb3bd5e76b4 100644
--- a/jstests/core/index_elemmatch1.js
+++ b/jstests/core/index_elemmatch1.js
@@ -1,9 +1,9 @@
-t = db.index_elemmatch1
-t.drop()
+t = db.index_elemmatch1;
+t.drop();
-x = 0
-y = 0
+x = 0;
+y = 0;
var bulk = t.initializeUnorderedBulkOp();
for ( a=0; a<100; a++ ){
for ( b=0; b<100; b++ ){
@@ -12,17 +12,17 @@ for ( a=0; a<100; a++ ){
}
assert.writeOK(bulk.execute());
-t.ensureIndex( { a : 1 , b : 1 } )
-t.ensureIndex( { "arr.x" : 1 , a : 1 } )
+t.ensureIndex( { a : 1 , b : 1 } );
+t.ensureIndex( { "arr.x" : 1 , a : 1 } );
assert.eq( 100 , t.find( { a : 55 } ).itcount() , "A1" );
assert.eq( 10 , t.find( { a : 55 , b : 7 } ).itcount() , "A2" );
-q = { a : 55 , b : { $in : [ 1 , 5 , 8 ] } }
-assert.eq( 30 , t.find( q ).itcount() , "A3" )
+q = { a : 55 , b : { $in : [ 1 , 5 , 8 ] } };
+assert.eq( 30 , t.find( q ).itcount() , "A3" );
-q.arr = { $elemMatch : { x : 5 , y : 5 } }
-assert.eq( 10 , t.find( q ).itcount() , "A4" )
+q.arr = { $elemMatch : { x : 5 , y : 5 } };
+assert.eq( 10 , t.find( q ).itcount() , "A4" );
function nscannedForCursor( explain, cursor ) {
plans = explain.allPlans;
diff --git a/jstests/core/index_many2.js b/jstests/core/index_many2.js
index f113b8b87ed..ac265e5cf6e 100644
--- a/jstests/core/index_many2.js
+++ b/jstests/core/index_many2.js
@@ -1,13 +1,13 @@
t = db.index_many2;
-t.drop()
+t.drop();
-t.save( { x : 1 } )
+t.save( { x : 1 } );
-assert.eq( 1 , t.getIndexKeys().length , "A1" )
+assert.eq( 1 , t.getIndexKeys().length , "A1" );
function make( n ){
- var x = {}
+ var x = {};
x["x"+n] = 1;
return x;
}
@@ -16,16 +16,16 @@ for ( i=1; i<1000; i++ ){
t.ensureIndex( make(i) );
}
-assert.eq( 64 , t.getIndexKeys().length , "A2" )
+assert.eq( 64 , t.getIndexKeys().length , "A2" );
-num = t.getIndexKeys().length
+num = t.getIndexKeys().length;
-t.dropIndex( make(num-1) )
-assert.eq( num - 1 , t.getIndexKeys().length , "B0" )
+t.dropIndex( make(num-1) );
+assert.eq( num - 1 , t.getIndexKeys().length , "B0" );
-t.ensureIndex( { z : 1 } )
-assert.eq( num , t.getIndexKeys().length , "B1" )
+t.ensureIndex( { z : 1 } );
+assert.eq( num , t.getIndexKeys().length , "B1" );
t.dropIndex( "*" );
-assert.eq( 1 , t.getIndexKeys().length , "C1" )
+assert.eq( 1 , t.getIndexKeys().length , "C1" );
diff --git a/jstests/core/index_sparse1.js b/jstests/core/index_sparse1.js
index 1a525f53d8a..950c8a8d797 100644
--- a/jstests/core/index_sparse1.js
+++ b/jstests/core/index_sparse1.js
@@ -2,44 +2,44 @@
t = db.index_sparse1;
t.drop();
-t.insert( { _id : 1 , x : 1 } )
-t.insert( { _id : 2 , x : 2 } )
-t.insert( { _id : 3 , x : 2 } )
-t.insert( { _id : 4 } )
-t.insert( { _id : 5 } )
-
-assert.eq( 5 , t.count() , "A1" )
-assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "A2" )
-
-t.ensureIndex( { x : 1 } )
-assert.eq( 2 , t.getIndexes().length , "B1" )
-assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "B2" )
-t.dropIndex( { x : 1 } )
-assert.eq( 1 , t.getIndexes().length , "B3" )
-
-t.ensureIndex( { x : 1 } , { sparse : 1 } )
-assert.eq( 2 , t.getIndexes().length , "C1" )
-assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "C2" )
-t.dropIndex( { x : 1 } )
-assert.eq( 1 , t.getIndexes().length , "C3" )
+t.insert( { _id : 1 , x : 1 } );
+t.insert( { _id : 2 , x : 2 } );
+t.insert( { _id : 3 , x : 2 } );
+t.insert( { _id : 4 } );
+t.insert( { _id : 5 } );
+
+assert.eq( 5 , t.count() , "A1" );
+assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "A2" );
+
+t.ensureIndex( { x : 1 } );
+assert.eq( 2 , t.getIndexes().length , "B1" );
+assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "B2" );
+t.dropIndex( { x : 1 } );
+assert.eq( 1 , t.getIndexes().length , "B3" );
+
+t.ensureIndex( { x : 1 } , { sparse : 1 } );
+assert.eq( 2 , t.getIndexes().length , "C1" );
+assert.eq( 5 , t.find().sort( { x : 1 } ).itcount() , "C2" );
+t.dropIndex( { x : 1 } );
+assert.eq( 1 , t.getIndexes().length , "C3" );
// -- sparse & unique
-t.remove( { _id : 2 } )
+t.remove( { _id : 2 } );
// test that we can't create a unique index without sparse
assert.commandFailed( t.ensureIndex( { x : 1 } , { unique : 1 } ));
-assert.eq( 1 , t.getIndexes().length , "D2" )
+assert.eq( 1 , t.getIndexes().length , "D2" );
-t.ensureIndex( { x : 1 } , { unique : 1 , sparse : 1 } )
-assert.eq( 2 , t.getIndexes().length , "E1" )
-t.dropIndex( { x : 1 } )
-assert.eq( 1 , t.getIndexes().length , "E3" )
+t.ensureIndex( { x : 1 } , { unique : 1 , sparse : 1 } );
+assert.eq( 2 , t.getIndexes().length , "E1" );
+t.dropIndex( { x : 1 } );
+assert.eq( 1 , t.getIndexes().length , "E3" );
-t.insert( { _id : 2 , x : 2 } )
-t.ensureIndex( { x : 1 } , { unique : 1 , sparse : 1 } )
-assert.eq( 1 , t.getIndexes().length , "F1" )
+t.insert( { _id : 2 , x : 2 } );
+t.ensureIndex( { x : 1 } , { unique : 1 , sparse : 1 } );
+assert.eq( 1 , t.getIndexes().length , "F1" );
diff --git a/jstests/core/index_sparse2.js b/jstests/core/index_sparse2.js
index 56a59db3711..4d5c5b84cd9 100644
--- a/jstests/core/index_sparse2.js
+++ b/jstests/core/index_sparse2.js
@@ -1,23 +1,23 @@
t = db.index_sparse2;
t.drop();
-t.insert( { _id : 1 , x : 1 , y : 1 } )
-t.insert( { _id : 2 , x : 2 } )
-t.insert( { _id : 3 } )
+t.insert( { _id : 1 , x : 1 , y : 1 } );
+t.insert( { _id : 2 , x : 2 } );
+t.insert( { _id : 3 } );
-t.ensureIndex( { x : 1 , y : 1 } )
-assert.eq( 2 , t.getIndexes().length , "A1" )
-assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).count() , "A2 count()" )
-assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).itcount() , "A2 itcount()" )
-t.dropIndex( { x : 1 , y : 1 } )
-assert.eq( 1 , t.getIndexes().length , "A3" )
+t.ensureIndex( { x : 1 , y : 1 } );
+assert.eq( 2 , t.getIndexes().length , "A1" );
+assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).count() , "A2 count()" );
+assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).itcount() , "A2 itcount()" );
+t.dropIndex( { x : 1 , y : 1 } );
+assert.eq( 1 , t.getIndexes().length , "A3" );
-t.ensureIndex( { x : 1 , y : 1 } , { sparse : 1 } )
-assert.eq( 2 , t.getIndexes().length , "B1" )
-assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).count() , "B2 count()" )
-assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).itcount() , "B2 itcount()" )
-t.dropIndex( { x : 1 , y : 1 } )
-assert.eq( 1 , t.getIndexes().length , "B3" )
+t.ensureIndex( { x : 1 , y : 1 } , { sparse : 1 } );
+assert.eq( 2 , t.getIndexes().length , "B1" );
+assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).count() , "B2 count()" );
+assert.eq( 3 , t.find().sort( { x : 1 , y : 1 } ).itcount() , "B2 itcount()" );
+t.dropIndex( { x : 1 , y : 1 } );
+assert.eq( 1 , t.getIndexes().length , "B3" );
diff --git a/jstests/core/index_stats.js b/jstests/core/index_stats.js
index 8d2f9fd4d60..fc4aca2a77f 100644
--- a/jstests/core/index_stats.js
+++ b/jstests/core/index_stats.js
@@ -18,7 +18,7 @@
}
return undefined;
- }
+ };
var getIndexKey = function(indexName) {
var cursor = col.aggregate([{$indexStats: {}}]);
@@ -31,7 +31,7 @@
}
return undefined;
- }
+ };
var getIndexNamesForWinningPlan = function(explain) {
var indexNameList = [];
@@ -41,7 +41,7 @@
}
return indexNameList;
- }
+ };
assert.writeOK(col.insert({a: 1, b: 1, c: 1}));
assert.writeOK(col.insert({a: 2, b: 2, c: 2}));
@@ -206,5 +206,5 @@
//
// Confirm that retrieval fails if $indexStats is not in the first pipeline position.
//
- assert.throws(function() { col.aggregate([{$match: {}}, {$indexStats: {}}]) });
+ assert.throws(function() { col.aggregate([{$match: {}}, {$indexStats: {}}]); });
})();
diff --git a/jstests/core/indexa.js b/jstests/core/indexa.js
index 7602183adb2..73da14fc8bc 100644
--- a/jstests/core/indexa.js
+++ b/jstests/core/indexa.js
@@ -15,7 +15,7 @@ assert.eq( 2 , t.count() , "indexa 1" );
t.update( {x:'B'}, { x:'A' } );
a = t.find().toArray();
-u = Array.unique( a.map( function(z){ return z.x } ) );
+u = Array.unique( a.map( function(z){ return z.x; } ) );
assert.eq( 2 , t.count() , "indexa 2" );
assert( a.length == u.length , "unique index update is broken" );
diff --git a/jstests/core/indexf.js b/jstests/core/indexf.js
index d65e7b1c898..3ad222bcbb8 100644
--- a/jstests/core/indexf.js
+++ b/jstests/core/indexf.js
@@ -1,5 +1,5 @@
-t = db.indexf
+t = db.indexf;
t.drop();
t.ensureIndex( { x : 1 } );
diff --git a/jstests/core/indexg.js b/jstests/core/indexg.js
index a0709fd6568..f4b2e0cada1 100644
--- a/jstests/core/indexg.js
+++ b/jstests/core/indexg.js
@@ -7,7 +7,7 @@ f.save( { list: [1, 3] } );
doit = function() {
assert.eq( 1, f.count( { list: { $in: [1], $ne: 3 } } ) );
assert.eq( 1, f.count( { list: { $in: [1], $not:{$in: [3] } } } ) );
-}
+};
doit();
f.ensureIndex( { list: 1 } );
doit(); \ No newline at end of file
diff --git a/jstests/core/indexl.js b/jstests/core/indexl.js
index 666586db7a7..3a5d0275887 100644
--- a/jstests/core/indexl.js
+++ b/jstests/core/indexl.js
@@ -9,9 +9,9 @@ function test(t) {
assert.eq( 1, t.count( {a:{$in:[2],$all:[1]}} ) );
assert.eq( 1, t.count( {a:{$in:[1],$all:[2]}} ) );
assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) );
- t.save({a:[3,4]})
- t.save({a:[2,3]})
- t.save({a:[1,2,3,4]})
+ t.save({a:[3,4]});
+ t.save({a:[2,3]});
+ t.save({a:[1,2,3,4]});
assert.eq( 2, t.count( {a:{$in:[2],$all:[1]}} ) );
assert.eq( 1, t.count( {a:{$in:[3],$all:[1,2]}} ) );
assert.eq( 1, t.count( {a:{$in:[1],$all:[3]}} ) );
diff --git a/jstests/core/indexm.js b/jstests/core/indexm.js
index d87e172a3eb..1c6f1c7baac 100644
--- a/jstests/core/indexm.js
+++ b/jstests/core/indexm.js
@@ -3,7 +3,7 @@
t = db.jstests_indexm;
t.drop();
-t.save( { a : [ { x : 1 } , { x : 2 } , { x : 3 } , { x : 4 } ] } )
+t.save( { a : [ { x : 1 } , { x : 2 } , { x : 3 } , { x : 4 } ] } );
function test(){
assert.eq( 1, t.count(
diff --git a/jstests/core/indexn.js b/jstests/core/indexn.js
index e868583257e..66a45d88836 100644
--- a/jstests/core/indexn.js
+++ b/jstests/core/indexn.js
@@ -17,12 +17,12 @@ assert.eq( 0, t.count( {a:{$gt:5,$lt:0},b:2} ) );
assert.eq( 0, t.count( {a:{$gt:5,$lt:0},b:{$gt:0,$lt:5}} ) );
// One clause of an $or is an "impossible match"
-printjson( t.find( {$or:[{a:{$gt:5,$lt:0}},{a:1}]} ).explain() )
+printjson( t.find( {$or:[{a:{$gt:5,$lt:0}},{a:1}]} ).explain() );
assert.eq( 1, t.count( {$or:[{a:{$gt:5,$lt:0}},{a:1}]} ) );
// One clause of an $or is an "impossible match"; original order of the $or
// does not matter.
-printjson( t.find( {$or:[{a:1},{a:{$gt:5,$lt:0}}]} ).explain() )
+printjson( t.find( {$or:[{a:1},{a:{$gt:5,$lt:0}}]} ).explain() );
assert.eq( 1, t.count( {$or:[{a:1},{a:{$gt:5,$lt:0}}]} ) );
t.save( {a:2} );
diff --git a/jstests/core/insert1.js b/jstests/core/insert1.js
index 1c0c0f90e87..ff53e2b2bd7 100644
--- a/jstests/core/insert1.js
+++ b/jstests/core/insert1.js
@@ -33,7 +33,7 @@ assert.eq(null, doc._id, tojson(doc));
t.drop();
var toInsert = [];
var count = 100 * 1000;
-for (i = 0; i < count; ++i) { toInsert.push({_id: i, a: 5}) }
+for (i = 0; i < count; ++i) { toInsert.push({_id: i, a: 5}); }
assert.writeOK(t.insert(toInsert));
doc = t.findOne({_id:1});
assert.eq(5, doc.a);
diff --git a/jstests/core/insert2.js b/jstests/core/insert2.js
index b409390a485..4d5de35bb36 100644
--- a/jstests/core/insert2.js
+++ b/jstests/core/insert2.js
@@ -7,8 +7,8 @@ conn.forceWriteMode(db.getMongo().writeMode());
t = conn.getDB(db.getName()).insert2;
t.drop();
-assert.isnull( t.findOne() , "A" )
+assert.isnull( t.findOne() , "A" );
assert.writeError(t.insert( { z : 1 , $inc : { x : 1 } } , 0, true ));
-assert.isnull( t.findOne() , "B" )
+assert.isnull( t.findOne() , "B" );
// Collection should not exist
assert.commandFailed( t.stats() );
diff --git a/jstests/core/js2.js b/jstests/core/js2.js
index 8753599887a..54c919ac1ba 100644
--- a/jstests/core/js2.js
+++ b/jstests/core/js2.js
@@ -18,6 +18,6 @@ assert.throws( function(){
} ).forEach( printjson );
} , null , "can't save from $where" );
-assert.eq( 0 , t2.find().length() , "B" )
+assert.eq( 0 , t2.find().length() , "B" );
assert(t.validate().valid , "E");
diff --git a/jstests/core/js3.js b/jstests/core/js3.js
index 4249ad6183d..97ed0bfb834 100644
--- a/jstests/core/js3.js
+++ b/jstests/core/js3.js
@@ -3,7 +3,7 @@ t = db.jstests_js3;
debug = function( s ){
//printjson( s );
-}
+};
for( z = 0; z < 2; z++ ) {
debug(z);
@@ -20,7 +20,7 @@ for( z = 0; z < 2; z++ ) {
assert( 33 == db.dbEval(function() { return 33; } ) );
- db.dbEval( function() { db.jstests_js3.save({i:-1, z:"server side"}) } );
+ db.dbEval( function() { db.jstests_js3.save({i:-1, z:"server side"}); } );
assert( t.findOne({i:-1}) );
diff --git a/jstests/core/js4.js b/jstests/core/js4.js
index 38cadf355de..3afa4720dd6 100644
--- a/jstests/core/js4.js
+++ b/jstests/core/js4.js
@@ -16,7 +16,7 @@ assert.eq( "/abc/i" , real.c.toString() , "regex 1" );
var cursor = t.find( { $where :
function(){
fullObject;
- assert.eq( 7 , Object.keySet( obj ).length , "A" )
+ assert.eq( 7 , Object.keySet( obj ).length , "A" );
assert.eq( 1 , obj.a , "B" );
assert.eq( "abc" , obj.b , "C" );
assert.eq( "/abc/i" , obj.c.toString() , "D" );
@@ -37,7 +37,7 @@ t.save( { a : 2 , b : { c : 7 , d : "d is good" } } );
var cursor = t.find( { $where :
function(){
fullObject;
- assert.eq( 3 , Object.keySet( obj ).length )
+ assert.eq( 3 , Object.keySet( obj ).length );
assert.eq( 2 , obj.a );
assert.eq( 7 , obj.b.c );
assert.eq( "d is good" , obj.b.d );
diff --git a/jstests/core/js5.js b/jstests/core/js5.js
index 84770d72da2..8fa45a0afe3 100644
--- a/jstests/core/js5.js
+++ b/jstests/core/js5.js
@@ -1,9 +1,9 @@
-t = db.jstests_js5
+t = db.jstests_js5;
t.drop();
-t.save( { a : 1 } )
-t.save( { a : 2 } )
+t.save( { a : 1 } );
+t.save( { a : 2 } );
assert.eq( 2 , t.find( { "$where" : "this.a" } ).count() , "A" );
assert.eq( 0 , t.find( { "$where" : "this.b" } ).count() , "B" );
diff --git a/jstests/core/js9.js b/jstests/core/js9.js
index 8748667f527..286adb9a1a4 100644
--- a/jstests/core/js9.js
+++ b/jstests/core/js9.js
@@ -21,4 +21,4 @@ assert.eq( 2 ,
return num;
}
)
- )
+ );
diff --git a/jstests/core/json1.js b/jstests/core/json1.js
index 054a9b46047..d4bb8435086 100644
--- a/jstests/core/json1.js
+++ b/jstests/core/json1.js
@@ -21,8 +21,8 @@ assert.eq(tojson(x,"",false), '{\n\t"x" : ObjectId("4ad35a73d2e34eb4fc43579a"),\
// Timestamp type
x = {"x" : Timestamp()};
-assert.eq(tojson(x,"",false), '{\n\t"x" : Timestamp(0, 0)\n}' , "G")
+assert.eq(tojson(x,"",false), '{\n\t"x" : Timestamp(0, 0)\n}' , "G");
// Timestamp type, second
x = {"x" : Timestamp(10,2)};
-assert.eq(tojson(x,"",false), '{\n\t"x" : Timestamp(10, 2)\n}' , "H")
+assert.eq(tojson(x,"",false), '{\n\t"x" : Timestamp(10, 2)\n}' , "H");
diff --git a/jstests/core/kill_cursors.js b/jstests/core/kill_cursors.js
index f413538670f..60dc5e2d3e4 100644
--- a/jstests/core/kill_cursors.js
+++ b/jstests/core/kill_cursors.js
@@ -111,7 +111,7 @@
// Pin the cursor during a getMore.
var code = 'db.runCommand({getMore: ' + cursorId.toString() +
- ', collection: "' + coll.getName() + '"});'
+ ', collection: "' + coll.getName() + '"});';
cleanup = startParallelShell(code);
// Sleep to make it more likely that the cursor will be pinned.
diff --git a/jstests/core/killop.js b/jstests/core/killop.js
index 220c636848f..f367d3dec33 100644
--- a/jstests/core/killop.js
+++ b/jstests/core/killop.js
@@ -12,7 +12,7 @@
* counted collection must not be empty; hence an initial write to the collection is required.
*/
-t = db.jstests_killop
+t = db.jstests_killop;
t.drop();
t.save( {x:1} );
diff --git a/jstests/core/loadserverscripts.js b/jstests/core/loadserverscripts.js
index c0b5a4065a1..4288ae973a0 100644
--- a/jstests/core/loadserverscripts.js
+++ b/jstests/core/loadserverscripts.js
@@ -27,7 +27,7 @@ x = testdb.system.js.count();
assert.eq( x, 3, "Should now be one function in the system.js collection");
// Set a global variable that will be over-written
-var changeme = true
+var changeme = true;
// Load that function
testdb.loadServerScripts();
diff --git a/jstests/core/loglong.js b/jstests/core/loglong.js
index 74f56a8f494..0a8889c2b25 100644
--- a/jstests/core/loglong.js
+++ b/jstests/core/loglong.js
@@ -7,21 +7,21 @@ t.drop();
t.insert( { x : 1 } );
n = 0;
-query = { x : [] }
+query = { x : [] };
while ( Object.bsonsize( query ) < 30000 ) {
query.x.push( n++ );
}
-before = db.adminCommand( { setParameter : 1 , logLevel : 1 } )
+before = db.adminCommand( { setParameter : 1 , logLevel : 1 } );
-t.findOne( query )
+t.findOne( query );
-x = db.adminCommand( { setParameter : 1 , logLevel : before.was } )
-assert.eq( 1 , x.was , tojson( x ) )
+x = db.adminCommand( { setParameter : 1 , logLevel : before.was } );
+assert.eq( 1 , x.was , tojson( x ) );
-log = db.adminCommand( { getLog : "global" } ).log
+log = db.adminCommand( { getLog : "global" } ).log;
-found = false
+found = false;
for ( i=log.length - 1; i>= 0; i-- ) {
if ( log[i].indexOf( "warning: log line attempted (16kB)" ) >= 0 ) {
found = true;
diff --git a/jstests/core/logprocessdetails.js b/jstests/core/logprocessdetails.js
index 607b1acb057..c53655843e1 100644
--- a/jstests/core/logprocessdetails.js
+++ b/jstests/core/logprocessdetails.js
@@ -14,7 +14,7 @@ doesLogMatchRegex = function(logArray, regex) {
}
}
return false;
-}
+};
doTest = function() {
var log = db.adminCommand({ getLog: 'global'});
@@ -34,6 +34,6 @@ doTest = function() {
var informationIsLogged = doesLogMatchRegex(log2.log, re);
assert.eq(informationIsLogged, true, "Process details not present in RAM log");
-}
+};
doTest();
diff --git a/jstests/core/map1.js b/jstests/core/map1.js
index 1db53cd3848..5697e41f32c 100644
--- a/jstests/core/map1.js
+++ b/jstests/core/map1.js
@@ -14,11 +14,11 @@ function basic1( key , lookup , shouldFail){
}
-basic1( 6 )
-basic1( new Date() )
-basic1( "eliot" )
+basic1( 6 );
+basic1( new Date() );
+basic1( "eliot" );
basic1( { a : 1 } );
-basic1( { a : 1 , b : 1 } )
-basic1( { a : 1 } , { b : 1 } , true )
-basic1( { a : 1 , b : 1 } , { b : 1 , a : 1 } , true )
+basic1( { a : 1 , b : 1 } );
+basic1( { a : 1 } , { b : 1 } , true );
+basic1( { a : 1 , b : 1 } , { b : 1 , a : 1 } , true );
basic1( { a : 1 } , { a : 2 } , true );
diff --git a/jstests/core/maxscan.js b/jstests/core/maxscan.js
index 0c7e97488cf..ab490f51de0 100644
--- a/jstests/core/maxscan.js
+++ b/jstests/core/maxscan.js
@@ -7,12 +7,12 @@ for ( i=0; i<N; i++ ){
t.insert( { _id : i , x : i % 10 } );
}
-assert.eq( N , t.find().itcount() , "A" )
-assert.eq( 50 , t.find().maxScan(50).itcount() , "B" )
+assert.eq( N , t.find().itcount() , "A" );
+assert.eq( 50 , t.find().maxScan(50).itcount() , "B" );
-assert.eq( 10 , t.find( { x : 2 } ).itcount() , "C" )
-assert.eq( 5 , t.find( { x : 2 } ).maxScan(50).itcount() , "D" )
+assert.eq( 10 , t.find( { x : 2 } ).itcount() , "C" );
+assert.eq( 5 , t.find( { x : 2 } ).maxScan(50).itcount() , "D" );
t.ensureIndex({x: 1});
-assert.eq( 10, t.find( { x : 2 } ).hint({x:1}).maxScan(N).itcount() , "E" )
-assert.eq( 0, t.find( { x : 2 } ).hint({x:1}).maxScan(1).itcount() , "E" )
+assert.eq( 10, t.find( { x : 2 } ).hint({x:1}).maxScan(N).itcount() , "E" );
+assert.eq( 0, t.find( { x : 2 } ).hint({x:1}).maxScan(1).itcount() , "E" );
diff --git a/jstests/core/minmax.js b/jstests/core/minmax.js
index c38cb093837..d6dc7cc1034 100644
--- a/jstests/core/minmax.js
+++ b/jstests/core/minmax.js
@@ -5,7 +5,7 @@ addData = function() {
t.save( { a: 1, b: 2 } );
t.save( { a: 2, b: 1 } );
t.save( { a: 2, b: 2 } );
-}
+};
t = db.jstests_minmax;
t.drop();
@@ -36,11 +36,11 @@ assert.eq( 1, t.find().min( { a: 2, b: 1 } ).hint( { a: 1, b: -1 } ).toArray().l
assert.eq( 1, t.find().max( { a: 1, b: 1.5 } ).hint( { a: 1, b: -1 } ).toArray().length );
// hint doesn't match
-assert.throws( function() { t.find().min( { a: 1 } ).hint( { a: 1, b: -1 } ).toArray() } );
-assert.throws( function() { t.find().min( { a: 1, b: 1 } ).max( { a: 1 } ).hint( { a: 1, b: -1 } ).toArray() } );
-assert.throws( function() { t.find().min( { b: 1 } ).max( { a: 1, b: 2 } ).hint( { a: 1, b: -1 } ).toArray() } );
-assert.throws( function() { t.find().min( { a: 1 } ).hint( { $natural: 1 } ).toArray() } );
-assert.throws( function() { t.find().max( { a: 1 } ).hint( { $natural: 1 } ).toArray() } );
+assert.throws( function() { t.find().min( { a: 1 } ).hint( { a: 1, b: -1 } ).toArray(); } );
+assert.throws( function() { t.find().min( { a: 1, b: 1 } ).max( { a: 1 } ).hint( { a: 1, b: -1 } ).toArray(); } );
+assert.throws( function() { t.find().min( { b: 1 } ).max( { a: 1, b: 2 } ).hint( { a: 1, b: -1 } ).toArray(); } );
+assert.throws( function() { t.find().min( { a: 1 } ).hint( { $natural: 1 } ).toArray(); } );
+assert.throws( function() { t.find().max( { a: 1 } ).hint( { $natural: 1 } ).toArray(); } );
// Reverse direction scan of the a:1 index between a:6 (inclusive) and a:3 (exclusive).
t.drop();
diff --git a/jstests/core/mr1.js b/jstests/core/mr1.js
index 9fdf48babdb..2d64a1375d7 100644
--- a/jstests/core/mr1.js
+++ b/jstests/core/mr1.js
@@ -108,7 +108,7 @@ res = db.runCommand( { mapreduce : "mr1" , map : m , reduce : r , out : "mr1_out
d( res );
assert.eq( 999 , res.counts.input , "Z1" );
x = db[res.result];
-x.find().forEach( d )
+x.find().forEach( d );
assert.eq( 4 , x.find().count() , "Z2" );
assert.eq( "a,b,c,d" , x.distinct( ks ) , "Z3" );
diff --git a/jstests/core/mr2.js b/jstests/core/mr2.js
index 0e3e087a378..21091c591b1 100644
--- a/jstests/core/mr2.js
+++ b/jstests/core/mr2.js
@@ -48,7 +48,7 @@ function f( who , res ){
}
res = t.mapReduce( m , r , { finalize : f , out : "mr2_out" } );
-printjson( res )
+printjson( res );
x = reformat( res );
assert.eq( 9 , x.a.avg , "A1" );
assert.eq( 16 , x.b.avg , "A2" );
@@ -58,16 +58,16 @@ res.drop();
// inline does needs to exist - so set it to false to make sure the code is just checking for
// existence
res = t.mapReduce( m , r , { finalize : f , out : { inline : 0 } } );
-printjson( res )
+printjson( res );
x = reformat( res );
assert.eq( 9 , x.a.avg , "B1" );
assert.eq( 16 , x.b.avg , "B2" );
assert.eq( 18 , x.c.avg , "B3" );
res.drop();
-assert( ! ( "result" in res ) , "B4" )
+assert( ! ( "result" in res ) , "B4" );
res = t.mapReduce( m , r , { finalize : f , out : "mr2_out", jsMode: true } );
-printjson( res )
+printjson( res );
x = reformat( res );
assert.eq( 9 , x.a.avg , "A1" );
assert.eq( 16 , x.b.avg , "A2" );
@@ -75,11 +75,11 @@ assert.eq( 18 , x.c.avg , "A3" );
res.drop();
res = t.mapReduce( m , r , { finalize : f , out : { inline : 5 }, jsMode: true } );
-printjson( res )
+printjson( res );
x = reformat( res );
assert.eq( 9 , x.a.avg , "B1" );
assert.eq( 16 , x.b.avg , "B2" );
assert.eq( 18 , x.c.avg , "B3" );
res.drop();
-assert( ! ( "result" in res ) , "B4" )
+assert( ! ( "result" in res ) , "B4" );
diff --git a/jstests/core/mr3.js b/jstests/core/mr3.js
index 3b0a918a4f3..48b38e430f0 100644
--- a/jstests/core/mr3.js
+++ b/jstests/core/mr3.js
@@ -26,7 +26,7 @@ r = function( key , values ){
};
res = t.mapReduce( m , r , { out : "mr3_out" } );
-z = res.convertToSingleObject()
+z = res.convertToSingleObject();
assert.eq( 3 , Object.keySet( z ).length , "A1" );
assert.eq( 2 , z.a.count , "A2" );
@@ -36,7 +36,7 @@ assert.eq( 3 , z.c.count , "A4" );
res.drop();
res = t.mapReduce( m , r , { out : "mr3_out" , mapparams : [ 2 , 2 ] } );
-z = res.convertToSingleObject()
+z = res.convertToSingleObject();
assert.eq( 3 , Object.keySet( z ).length , "B1" );
assert.eq( 8 , z.a.count , "B2" );
@@ -51,13 +51,13 @@ realm = m;
m = function(){
emit( this._id , 1 );
-}
+};
res = t.mapReduce( m , r , { out : "mr3_out" } );
res.drop();
m = function(){
emit( this._id , this.xzz.a );
-}
+};
before = db.getCollectionNames().length;
assert.throws( function(){ t.mapReduce( m , r , { out : "mr3_out" } ); } );
@@ -67,7 +67,7 @@ assert.eq( before , db.getCollectionNames().length , "after throw crap" );
m = realm;
r = function( k , v ){
return v.x.x.x;
-}
+};
before = db.getCollectionNames().length;
-assert.throws( function(){ t.mapReduce( m , r , "mr3_out" ) } )
+assert.throws( function(){ t.mapReduce( m , r , "mr3_out" ); } );
assert.eq( before , db.getCollectionNames().length , "after throw crap" );
diff --git a/jstests/core/mr4.js b/jstests/core/mr4.js
index 78c8bce8953..2e989c19bff 100644
--- a/jstests/core/mr4.js
+++ b/jstests/core/mr4.js
@@ -24,7 +24,7 @@ r = function( key , values ){
};
res = t.mapReduce( m , r , { out : "mr4_out" , scope : { xx : 1 } } );
-z = res.convertToSingleObject()
+z = res.convertToSingleObject();
assert.eq( 3 , Object.keySet( z ).length , "A1" );
assert.eq( 2 , z.a.count , "A2" );
@@ -35,7 +35,7 @@ res.drop();
res = t.mapReduce( m , r , { scope : { xx : 2 } , out : "mr4_out" } );
-z = res.convertToSingleObject()
+z = res.convertToSingleObject();
assert.eq( 3 , Object.keySet( z ).length , "A1" );
assert.eq( 4 , z.a.count , "A2" );
diff --git a/jstests/core/mr5.js b/jstests/core/mr5.js
index 50a63d1d55b..786ef2cb8bf 100644
--- a/jstests/core/mr5.js
+++ b/jstests/core/mr5.js
@@ -2,57 +2,57 @@
t = db.mr5;
t.drop();
-t.save( { "partner" : 1, "visits" : 9 } )
-t.save( { "partner" : 2, "visits" : 9 } )
-t.save( { "partner" : 1, "visits" : 11 } )
-t.save( { "partner" : 1, "visits" : 30 } )
-t.save( { "partner" : 2, "visits" : 41 } )
-t.save( { "partner" : 2, "visits" : 41 } )
+t.save( { "partner" : 1, "visits" : 9 } );
+t.save( { "partner" : 2, "visits" : 9 } );
+t.save( { "partner" : 1, "visits" : 11 } );
+t.save( { "partner" : 1, "visits" : 30 } );
+t.save( { "partner" : 2, "visits" : 41 } );
+t.save( { "partner" : 2, "visits" : 41 } );
m = function(){
- emit( this.partner , { stats : [ this.visits ] } )
-}
+ emit( this.partner , { stats : [ this.visits ] } );
+};
r = function( k , v ){
var stats = [];
var total = 0;
for ( var i=0; i<v.length; i++ ){
for ( var j in v[i].stats ) {
- stats.push( v[i].stats[j] )
+ stats.push( v[i].stats[j] );
total += v[i].stats[j];
}
}
- return { stats : stats , total : total }
-}
+ return { stats : stats , total : total };
+};
res = t.mapReduce( m , r , { out : "mr5_out" , scope : { xx : 1 } } );
//res.find().forEach( printjson )
-z = res.convertToSingleObject()
-assert.eq( 2 , Object.keySet( z ).length , "A1" )
-assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "A2" )
-assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "A3" )
+z = res.convertToSingleObject();
+assert.eq( 2 , Object.keySet( z ).length , "A1" );
+assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "A2" );
+assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "A3" );
-res.drop()
+res.drop();
m = function(){
var x = "partner";
var y = "visits";
- emit( this[x] , { stats : [ this[y] ] } )
-}
+ emit( this[x] , { stats : [ this[y] ] } );
+};
res = t.mapReduce( m , r , { out : "mr5_out" , scope : { xx : 1 } } );
//res.find().forEach( printjson )
-z = res.convertToSingleObject()
-assert.eq( 2 , Object.keySet( z ).length , "B1" )
-assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B2" )
-assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B3" )
+z = res.convertToSingleObject();
+assert.eq( 2 , Object.keySet( z ).length , "B1" );
+assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B2" );
+assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B3" );
-res.drop()
+res.drop();
diff --git a/jstests/core/mr_bigobject.js b/jstests/core/mr_bigobject.js
index 00ef8af2b9b..b7bfed4e4ab 100644
--- a/jstests/core/mr_bigobject.js
+++ b/jstests/core/mr_bigobject.js
@@ -1,6 +1,6 @@
-t = db.mr_bigobject
-t.drop()
+t = db.mr_bigobject;
+t.drop();
var large = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
var s = large;
@@ -9,37 +9,37 @@ while ( s.length < ( 6 * 1024 * 1024 ) ){
}
for ( i=0; i<5; i++ )
- t.insert( { _id : i , s : s } )
+ t.insert( { _id : i , s : s } );
m = function(){
emit( 1 , this.s + this.s );
-}
+};
r = function( k , v ){
return 1;
-}
+};
-assert.throws( function(){ r = t.mapReduce( m , r , "mr_bigobject_out" ); } , null , "emit should fail" )
+assert.throws( function(){ r = t.mapReduce( m , r , "mr_bigobject_out" ); } , null , "emit should fail" );
m = function(){
emit( 1 , this.s );
-}
+};
-assert.eq( { 1 : 1 } , t.mapReduce( m , r , "mr_bigobject_out" ).convertToSingleObject() , "A1" )
+assert.eq( { 1 : 1 } , t.mapReduce( m , r , "mr_bigobject_out" ).convertToSingleObject() , "A1" );
r = function( k , v ){
total = 0;
for ( var i=0; i<v.length; i++ ){
var x = v[i];
if ( typeof( x ) == "number" )
- total += x
+ total += x;
else
total += x.length;
}
return total;
-}
+};
-assert.eq( { 1 : t.count() * s.length } , t.mapReduce( m , r , "mr_bigobject_out" ).convertToSingleObject() , "A1" )
+assert.eq( { 1 : t.count() * s.length } , t.mapReduce( m , r , "mr_bigobject_out" ).convertToSingleObject() , "A1" );
-t.drop()
+t.drop();
diff --git a/jstests/core/mr_comments.js b/jstests/core/mr_comments.js
index f6a06994f55..406ddb40a45 100644
--- a/jstests/core/mr_comments.js
+++ b/jstests/core/mr_comments.js
@@ -1,10 +1,10 @@
-t = db.mr_comments
-t.drop()
+t = db.mr_comments;
+t.drop();
-t.insert( { foo : 1 } )
-t.insert( { foo : 1 } )
-t.insert( { foo : 2 } )
+t.insert( { foo : 1 } );
+t.insert( { foo : 1 } );
+t.insert( { foo : 2 } );
res = db.runCommand(
{ mapreduce : "mr_comments",
@@ -14,7 +14,7 @@ res = db.runCommand(
},
out: "mr_comments_out"
});
-assert.eq( 3 , res.counts.emit )
+assert.eq( 3 , res.counts.emit );
res = db.runCommand(
{ mapreduce : "mr_comments",
@@ -25,4 +25,4 @@ res = db.runCommand(
out: "mr_comments_out"
});
-assert.eq( 3 , res.counts.emit )
+assert.eq( 3 , res.counts.emit );
diff --git a/jstests/core/mr_errorhandling.js b/jstests/core/mr_errorhandling.js
index c4e1137b4c6..1bd94bbd56e 100644
--- a/jstests/core/mr_errorhandling.js
+++ b/jstests/core/mr_errorhandling.js
@@ -2,31 +2,31 @@
t = db.mr_errorhandling;
t.drop();
-t.save( { a : [ 1 , 2 , 3 ] } )
-t.save( { a : [ 2 , 3 , 4 ] } )
+t.save( { a : [ 1 , 2 , 3 ] } );
+t.save( { a : [ 2 , 3 , 4 ] } );
m_good = function(){
for ( var i=0; i<this.a.length; i++ ){
emit( this.a[i] , 1 );
}
-}
+};
m_bad = function(){
for ( var i=0; i<this.a.length; i++ ){
emit( this.a[i] );
}
-}
+};
r = function( k , v ){
var total = 0;
for ( var i=0; i<v.length; i++ )
total += v[i];
return total;
-}
+};
res = t.mapReduce( m_good , r , "mr_errorhandling_out" );
assert.eq( { 1 : 1 , 2 : 2 , 3 : 2 , 4 : 1 } , res.convertToSingleObject() , "A" );
-res.drop()
+res.drop();
res = null;
@@ -44,6 +44,6 @@ assert( theerror.indexOf( "emit" ) >= 0 , "B3" );
// test things are still in an ok state
res = t.mapReduce( m_good , r , "mr_errorhandling_out" );
assert.eq( { 1 : 1 , 2 : 2 , 3 : 2 , 4 : 1 } , res.convertToSingleObject() , "A" );
-res.drop()
+res.drop();
-assert.throws( function(){ t.mapReduce( m_good , r , { out : "xxx" , query : "foo" } ); } )
+assert.throws( function(){ t.mapReduce( m_good , r , { out : "xxx" , query : "foo" } ); } );
diff --git a/jstests/core/mr_index.js b/jstests/core/mr_index.js
index 6c606cfa1dc..fd650852871 100644
--- a/jstests/core/mr_index.js
+++ b/jstests/core/mr_index.js
@@ -1,39 +1,39 @@
-t = db.mr_index
-t.drop()
+t = db.mr_index;
+t.drop();
-outName = "mr_index_out"
-out = db[outName]
-out.drop()
+outName = "mr_index_out";
+out = db[outName];
+out.drop();
-t.insert( { tags : [ 1 ] } )
-t.insert( { tags : [ 1 , 2 ] } )
-t.insert( { tags : [ 1 , 2 , 3 ] } )
-t.insert( { tags : [ 3 ] } )
-t.insert( { tags : [ 2 , 3 ] } )
-t.insert( { tags : [ 2 , 3 ] } )
-t.insert( { tags : [ 1 , 2 ] } )
+t.insert( { tags : [ 1 ] } );
+t.insert( { tags : [ 1 , 2 ] } );
+t.insert( { tags : [ 1 , 2 , 3 ] } );
+t.insert( { tags : [ 3 ] } );
+t.insert( { tags : [ 2 , 3 ] } );
+t.insert( { tags : [ 2 , 3 ] } );
+t.insert( { tags : [ 1 , 2 ] } );
m = function(){
for ( i=0; i<this.tags.length; i++ )
emit( this.tags[i] , 1 );
-}
+};
r = function( k , vs ){
return Array.sum( vs );
-}
+};
ex = function(){
- return out.find().sort( { value : 1 } ).explain("executionStats")
-}
+ return out.find().sort( { value : 1 } ).explain("executionStats");
+};
-res = t.mapReduce( m , r , { out : outName } )
+res = t.mapReduce( m , r , { out : outName } );
-assert.eq( 3 , ex().executionStats.nReturned , "A1" )
-out.ensureIndex( { value : 1 } )
-assert.eq( 3 , ex().executionStats.nReturned , "A2" )
+assert.eq( 3 , ex().executionStats.nReturned , "A1" );
+out.ensureIndex( { value : 1 } );
+assert.eq( 3 , ex().executionStats.nReturned , "A2" );
-res = t.mapReduce( m , r , { out : outName } )
+res = t.mapReduce( m , r , { out : outName } );
-assert.eq( 3 , ex().executionStats.nReturned , "B1" )
-res.drop()
+assert.eq( 3 , ex().executionStats.nReturned , "B1" );
+res.drop();
diff --git a/jstests/core/mr_index2.js b/jstests/core/mr_index2.js
index a8d845ed69d..3255f5507f4 100644
--- a/jstests/core/mr_index2.js
+++ b/jstests/core/mr_index2.js
@@ -1,22 +1,22 @@
t = db.mr_index2;
-t.drop()
+t.drop();
-t.save( { arr : [1, 2] } )
+t.save( { arr : [1, 2] } );
-map = function() { emit(this._id, 1) }
-reduce = function(k,vals) { return Array.sum( vals ); }
+map = function() { emit(this._id, 1); };
+reduce = function(k,vals) { return Array.sum( vals ); };
-res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : {} })
-assert.eq( 1 ,res.counts.input , "A" )
-res.drop()
+res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : {} });
+assert.eq( 1 ,res.counts.input , "A" );
+res.drop();
-res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : { arr: {$gte:0} } })
-assert.eq( 1 ,res.counts.input , "B" )
-res.drop()
+res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : { arr: {$gte:0} } });
+assert.eq( 1 ,res.counts.input , "B" );
+res.drop();
-t.ensureIndex({arr:1})
-res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : { arr: {$gte:0} } })
-assert.eq( 1 ,res.counts.input , "C" )
+t.ensureIndex({arr:1});
+res = t.mapReduce(map,reduce, { out : "mr_index2_out" , query : { arr: {$gte:0} } });
+assert.eq( 1 ,res.counts.input , "C" );
res.drop();
diff --git a/jstests/core/mr_index3.js b/jstests/core/mr_index3.js
index 0607cc8aa84..d667a844ec9 100644
--- a/jstests/core/mr_index3.js
+++ b/jstests/core/mr_index3.js
@@ -1,5 +1,5 @@
-t = db.mr_index3
+t = db.mr_index3;
t.drop();
t.insert( { _id : 1, name : 'name1', tags : ['dog', 'cat'] } );
@@ -9,16 +9,16 @@ t.insert( { _id : 4, name : 'name4', tags : [] } );
m = function(){
for ( var i=0; i<this.tags.length; i++ )
- emit( this.tags[i] , 1 )
+ emit( this.tags[i] , 1 );
};
r = function( key , values ){
return Array.sum( values );
};
-a1 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r , out : { inline : true } } ).results
-a2 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : 'name1'} , out : { inline : true }}).results
-a3 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : {$gt:'name'} } , out : { inline : true }}).results
+a1 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r , out : { inline : true } } ).results;
+a2 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : 'name1'} , out : { inline : true }}).results;
+a3 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : {$gt:'name'} } , out : { inline : true }}).results;
assert.eq( [
{
@@ -34,17 +34,17 @@ assert.eq( [
"value" : 1
}
] , a1 , "A1" );
-assert.eq( [ { "_id" : "cat", "value" : 1 }, { "_id" : "dog", "value" : 1 } ] , a2 , "A2" )
-assert.eq( a1 , a3 , "A3" )
+assert.eq( [ { "_id" : "cat", "value" : 1 }, { "_id" : "dog", "value" : 1 } ] , a2 , "A2" );
+assert.eq( a1 , a3 , "A3" );
t.ensureIndex({name:1, tags:1});
-b1 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r , out : { inline : true } } ).results
-b2 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : 'name1'} , out : { inline : true }}).results
-b3 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : {$gt:'name'} } , out : { inline : true }}).results
+b1 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r , out : { inline : true } } ).results;
+b2 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : 'name1'} , out : { inline : true }}).results;
+b3 = db.runCommand({ mapreduce : 'mr_index3', map : m, reduce : r, query: {name : {$gt:'name'} } , out : { inline : true }}).results;
-assert.eq( a1 , b1 , "AB1" )
-assert.eq( a2 , b2 , "AB2" )
-assert.eq( a3 , b3 , "AB3" )
+assert.eq( a1 , b1 , "AB1" );
+assert.eq( a2 , b2 , "AB2" );
+assert.eq( a3 , b3 , "AB3" );
diff --git a/jstests/core/mr_killop.js b/jstests/core/mr_killop.js
index db1f2b945ec..3f9cf52052d 100644
--- a/jstests/core/mr_killop.js
+++ b/jstests/core/mr_killop.js
@@ -84,7 +84,7 @@ function testOne( map, reduce, finalize, scope, childLoop, wait ) {
}
o = null;
- assert.soon( function() { o = op( childLoop ); return o != -1 } );
+ assert.soon( function() { o = op( childLoop ); return o != -1; } );
res = db.killOp( o );
debug( "did kill : " + tojson( res ) );
@@ -125,7 +125,7 @@ function runMRTests( loop, childLoop ) {
debug( " Running finalization test - loop map function. with scope " );
test( function() { loop(); }, // map
- function( k, v ) { return v[ 0 ] }, // reduce
+ function( k, v ) { return v[ 0 ]; }, // reduce
null, // finalize
{ loop: loop }, // scope
childLoop );
@@ -135,15 +135,15 @@ function runMRTests( loop, childLoop ) {
function runFinalizeTests( loop, childLoop ) {
debug( " Running finalization test - no scope " );
test( function() { emit( this.a, 1 ); }, // map
- function( k, v ) { return v[ 0 ] }, // reduce
+ function( k, v ) { return v[ 0 ]; }, // reduce
loop, // finalize
null, // scope
childLoop );
debug( " Running finalization test - with scope " );
test( function() { emit( this.a, 1 ); }, // map
- function( k, v ) { return v[ 0 ] }, // reduce
- function( a, b ) { loop() }, // finalize
+ function( k, v ) { return v[ 0 ]; }, // reduce
+ function( a, b ) { loop(); }, // finalize
{ loop: loop }, // scope
childLoop );
}
@@ -153,6 +153,6 @@ var loop = function() {
while( 1 ) {
sleep( 1000 );
}
-}
+};
runMRTests( loop, false );
runFinalizeTests( loop, false );
diff --git a/jstests/core/mr_merge.js b/jstests/core/mr_merge.js
index 9350c45f773..83d00f39392 100644
--- a/jstests/core/mr_merge.js
+++ b/jstests/core/mr_merge.js
@@ -2,16 +2,16 @@
t = db.mr_merge;
t.drop();
-t.insert( { a : [ 1 , 2 ] } )
-t.insert( { a : [ 2 , 3 ] } )
-t.insert( { a : [ 3 , 4 ] } )
+t.insert( { a : [ 1 , 2 ] } );
+t.insert( { a : [ 2 , 3 ] } );
+t.insert( { a : [ 3 , 4 ] } );
outName = "mr_merge_out";
out = db[outName];
out.drop();
-m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); }
-r = function(k,vs){ return Array.sum( vs ); }
+m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); };
+r = function(k,vs){ return Array.sum( vs ); };
function tos( o ){
var s = "";
@@ -23,38 +23,38 @@ function tos( o ){
}
-res = t.mapReduce( m , r , { out : outName } )
+res = t.mapReduce( m , r , { out : outName } );
-expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 }
+expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 };
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "A" );
-t.insert( { a : [ 4 , 5 ] } )
-out.insert( { _id : 10 , value : "5" } )
-res = t.mapReduce( m , r , { out : outName } )
+t.insert( { a : [ 4 , 5 ] } );
+out.insert( { _id : 10 , value : "5" } );
+res = t.mapReduce( m , r , { out : outName } );
expected["4"]++;
-expected["5"] = 1
+expected["5"] = 1;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "B" );
-t.insert( { a : [ 5 , 6 ] } )
-out.insert( { _id : 10 , value : "5" } )
-res = t.mapReduce( m , r , { out : { merge : outName } } )
+t.insert( { a : [ 5 , 6 ] } );
+out.insert( { _id : 10 , value : "5" } );
+res = t.mapReduce( m , r , { out : { merge : outName } } );
expected["5"]++;
-expected["10"] = 5
-expected["6"] = 1
+expected["10"] = 5;
+expected["6"] = 1;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "C" );
// test that the nonAtomic output gives valid result
-t.insert( { a : [ 6 , 7 ] } )
-out.insert( { _id : 20 , value : "10" } )
-res = t.mapReduce( m , r , { out : { merge : outName, nonAtomic: true } } )
+t.insert( { a : [ 6 , 7 ] } );
+out.insert( { _id : 20 , value : "10" } );
+res = t.mapReduce( m , r , { out : { merge : outName, nonAtomic: true } } );
expected["6"]++;
-expected["20"] = 10
-expected["7"] = 1
+expected["20"] = 10;
+expected["7"] = 1;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "D" );
diff --git a/jstests/core/mr_merge2.js b/jstests/core/mr_merge2.js
index 520bbfdbc8e..a4835e4397a 100644
--- a/jstests/core/mr_merge2.js
+++ b/jstests/core/mr_merge2.js
@@ -2,16 +2,16 @@
t = db.mr_merge2;
t.drop();
-t.insert( { a : [ 1 , 2 ] } )
-t.insert( { a : [ 2 , 3 ] } )
-t.insert( { a : [ 3 , 4 ] } )
+t.insert( { a : [ 1 , 2 ] } );
+t.insert( { a : [ 2 , 3 ] } );
+t.insert( { a : [ 3 , 4 ] } );
outName = "mr_merge2_out";
out = db[outName];
out.drop();
-m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); }
-r = function(k,vs){ return Array.sum( vs ); }
+m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); };
+r = function(k,vs){ return Array.sum( vs ); };
function tos( o ){
var s = "";
@@ -23,15 +23,15 @@ function tos( o ){
}
-outOptions = { out : { merge : outName } }
+outOptions = { out : { merge : outName } };
-res = t.mapReduce( m , r , outOptions )
-expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 }
+res = t.mapReduce( m , r , outOptions );
+expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 };
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "A" );
-t.insert( { a : [ 4 , 5 ] } )
-res = t.mapReduce( m , r , outOptions )
+t.insert( { a : [ 4 , 5 ] } );
+res = t.mapReduce( m , r , outOptions );
expected["4"]++;
-expected["5"] = 1
+expected["5"] = 1;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "B" );
diff --git a/jstests/core/mr_mutable_properties.js b/jstests/core/mr_mutable_properties.js
index 7c4442aab9e..e46f35b5079 100644
--- a/jstests/core/mr_mutable_properties.js
+++ b/jstests/core/mr_mutable_properties.js
@@ -14,7 +14,7 @@ var map = function() {
this.a = {cake:1};
emit(this._id, this.feed);
emit(this._id, this.a);
-}
+};
var reduce = function(key, values) {
// set property on receiver
@@ -30,7 +30,7 @@ var reduce = function(key, values) {
// modify each value in the (modified) array arg
values.forEach(function(val) { val.mod = 1; });
return {food:values};
-}
+};
var finalize = function(key, values) {
// set property on receiver
@@ -47,7 +47,7 @@ var finalize = function(key, values) {
// modify each value in the (modified) array arg
values.food.forEach(function(val) { val.mod = 1; });
return values;
-}
+};
var mr = collection.mapReduce(map, reduce, {finalize: finalize, out: {inline: 1}});
printjson(mr);
diff --git a/jstests/core/mr_optim.js b/jstests/core/mr_optim.js
index 164839e2f2c..65550d1c841 100644
--- a/jstests/core/mr_optim.js
+++ b/jstests/core/mr_optim.js
@@ -31,7 +31,7 @@ function reformat( r ){
}
res = t.mapReduce( m , r , { out : "mr_optim_out" } );
-printjson( res )
+printjson( res );
x = reformat( res );
for (var key in x) {
assert.eq(x[key], 13, "value is not equal to original, maybe reduce has run");
@@ -43,6 +43,6 @@ res = t.mapReduce( m , r , { out : { inline : 1 } } );
x2 = reformat( res );
res.drop();
-assert.eq(x, x2, "object from inline and collection are not equal")
+assert.eq(x, x2, "object from inline and collection are not equal");
t.drop(); \ No newline at end of file
diff --git a/jstests/core/mr_outreduce.js b/jstests/core/mr_outreduce.js
index 793ec252feb..d380d169751 100644
--- a/jstests/core/mr_outreduce.js
+++ b/jstests/core/mr_outreduce.js
@@ -2,48 +2,48 @@
t = db.mr_outreduce;
t.drop();
-t.insert( { _id : 1 , a : [ 1 , 2 ] } )
-t.insert( { _id : 2 , a : [ 2 , 3 ] } )
-t.insert( { _id : 3 , a : [ 3 , 4 ] } )
+t.insert( { _id : 1 , a : [ 1 , 2 ] } );
+t.insert( { _id : 2 , a : [ 2 , 3 ] } );
+t.insert( { _id : 3 , a : [ 3 , 4 ] } );
outName = "mr_outreduce_out";
out = db[outName];
out.drop();
-m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); }
-r = function(k,vs){ return Array.sum( vs ); }
+m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); };
+r = function(k,vs){ return Array.sum( vs ); };
function tos( o ){
var s = "";
for ( var i=0; i<100; i++ ){
if ( o[i] )
- s += i + "_" + o[i] + "|"
+ s += i + "_" + o[i] + "|";
}
return s;
}
-res = t.mapReduce( m , r , { out : outName } )
+res = t.mapReduce( m , r , { out : outName } );
-expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 }
+expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 };
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "A" );
-t.insert( { _id : 4 , a : [ 4 , 5 ] } )
-out.insert( { _id : 10 , value : "5" } ) // this is a sentinal to make sure it wasn't killed
-res = t.mapReduce( m , r , { out : { reduce : outName } , query : { _id : { $gt : 3 } } } )
+t.insert( { _id : 4 , a : [ 4 , 5 ] } );
+out.insert( { _id : 10 , value : "5" } ); // this is a sentinal to make sure it wasn't killed
+res = t.mapReduce( m , r , { out : { reduce : outName } , query : { _id : { $gt : 3 } } } );
expected["4"]++;
-expected["5"] = 1
-expected["10"] = 5
+expected["5"] = 1;
+expected["10"] = 5;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "B" );
-t.insert( { _id : 5 , a : [ 5 , 6 ] } )
-out.insert( { _id : 20 , value : "10" } ) // this is a sentinal to make sure it wasn't killed
-res = t.mapReduce( m , r , { out : { reduce : outName, nonAtomic: true } , query : { _id : { $gt : 4 } } } )
+t.insert( { _id : 5 , a : [ 5 , 6 ] } );
+out.insert( { _id : 20 , value : "10" } ); // this is a sentinal to make sure it wasn't killed
+res = t.mapReduce( m , r , { out : { reduce : outName, nonAtomic: true } , query : { _id : { $gt : 4 } } } );
expected["5"]++;
-expected["6"] = 1
-expected["20"] = 10
+expected["6"] = 1;
+expected["20"] = 10;
assert.eq( tos( expected ) , tos( res.convertToSingleObject() ) , "C" );
diff --git a/jstests/core/mr_outreduce2.js b/jstests/core/mr_outreduce2.js
index fc273638577..45ec9be7ee2 100644
--- a/jstests/core/mr_outreduce2.js
+++ b/jstests/core/mr_outreduce2.js
@@ -1,27 +1,27 @@
-normal = "mr_outreduce2"
-out = normal + "_out"
+normal = "mr_outreduce2";
+out = normal + "_out";
-t = db[normal]
+t = db[normal];
t.drop();
-db[out].drop()
+db[out].drop();
-t.insert( { _id : 1 , x : 1 } )
-t.insert( { _id : 2 , x : 1 } )
-t.insert( { _id : 3 , x : 2 } )
+t.insert( { _id : 1 , x : 1 } );
+t.insert( { _id : 2 , x : 1 } );
+t.insert( { _id : 3 , x : 2 } );
-m = function(){ emit( this.x , 1 ); }
-r = function(k,v){ return Array.sum( v ); }
+m = function(){ emit( this.x , 1 ); };
+r = function(k,v){ return Array.sum( v ); };
-res = t.mapReduce( m , r , { out : { reduce : out } , query : { _id : { $gt : 0 } } } )
+res = t.mapReduce( m , r , { out : { reduce : out } , query : { _id : { $gt : 0 } } } );
-assert.eq( 2 , db[out].findOne( { _id : 1 } ).value , "A1" )
-assert.eq( 1 , db[out].findOne( { _id : 2 } ).value , "A2" )
+assert.eq( 2 , db[out].findOne( { _id : 1 } ).value , "A1" );
+assert.eq( 1 , db[out].findOne( { _id : 2 } ).value , "A2" );
-t.insert( { _id : 4 , x : 2 } )
-res = t.mapReduce( m , r , { out : { reduce : out } , query : { _id : { $gt : 3 } } , finalize : null } )
+t.insert( { _id : 4 , x : 2 } );
+res = t.mapReduce( m , r , { out : { reduce : out } , query : { _id : { $gt : 3 } } , finalize : null } );
-assert.eq( 2 , db[out].findOne( { _id : 1 } ).value , "B1" )
-assert.eq( 2 , db[out].findOne( { _id : 2 } ).value , "B2" )
+assert.eq( 2 , db[out].findOne( { _id : 1 } ).value , "B1" );
+assert.eq( 2 , db[out].findOne( { _id : 2 } ).value , "B2" );
diff --git a/jstests/core/mr_replaceIntoDB.js b/jstests/core/mr_replaceIntoDB.js
index 217f40717e5..34c208255ee 100644
--- a/jstests/core/mr_replaceIntoDB.js
+++ b/jstests/core/mr_replaceIntoDB.js
@@ -2,15 +2,15 @@
t = db.mr_replace;
t.drop();
-t.insert( { a : [ 1 , 2 ] } )
-t.insert( { a : [ 2 , 3 ] } )
-t.insert( { a : [ 3 , 4 ] } )
+t.insert( { a : [ 1 , 2 ] } );
+t.insert( { a : [ 2 , 3 ] } );
+t.insert( { a : [ 3 , 4 ] } );
outCollStr = "mr_replace_col";
outDbStr = "mr_db";
-m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); }
-r = function(k,vs){ return Array.sum( vs ); }
+m = function(){ for (i=0; i<this.a.length; i++ ) emit( this.a[i] , 1 ); };
+r = function(k,vs){ return Array.sum( vs ); };
function tos( o ){
var s = "";
@@ -21,24 +21,24 @@ function tos( o ){
return s;
}
-print("Testing mr replace into other DB")
-res = t.mapReduce( m , r , { out : { replace: outCollStr, db: outDbStr } } )
+print("Testing mr replace into other DB");
+res = t.mapReduce( m , r , { out : { replace: outCollStr, db: outDbStr } } );
printjson( res );
expected = { "1" : 1 , "2" : 2 , "3" : 2 , "4" : 1 };
outDb = db.getMongo().getDB(outDbStr);
outColl = outDb[outCollStr];
-str = tos( outColl.convertToSingleObject("value") )
+str = tos( outColl.convertToSingleObject("value") );
print("Received result: " + str);
assert.eq( tos( expected ) , str , "A Received wrong result " + str );
print("checking result field");
-assert.eq(res.result.collection, outCollStr, "B1 Wrong collection " + res.result.collection)
-assert.eq(res.result.db, outDbStr, "B2 Wrong db " + res.result.db)
+assert.eq(res.result.collection, outCollStr, "B1 Wrong collection " + res.result.collection);
+assert.eq(res.result.db, outDbStr, "B2 Wrong db " + res.result.db);
print("Replace again and check");
outColl.save({_id: "5", value : 1});
-t.mapReduce( m , r , { out : { replace: outCollStr, db: outDbStr } } )
-str = tos( outColl.convertToSingleObject("value") )
+t.mapReduce( m , r , { out : { replace: outCollStr, db: outDbStr } } );
+str = tos( outColl.convertToSingleObject("value") );
print("Received result: " + str);
assert.eq( tos( expected ) , str , "C1 Received wrong result " + str );
diff --git a/jstests/core/mr_sort.js b/jstests/core/mr_sort.js
index cc8db18e174..8d0ba96ad82 100644
--- a/jstests/core/mr_sort.js
+++ b/jstests/core/mr_sort.js
@@ -1,43 +1,43 @@
t = db.mr_sort;
-t.drop()
+t.drop();
-t.ensureIndex( { x : 1 } )
+t.ensureIndex( { x : 1 } );
-t.insert( { x : 1 } )
-t.insert( { x : 10 } )
-t.insert( { x : 2 } )
-t.insert( { x : 9 } )
-t.insert( { x : 3 } )
-t.insert( { x : 8 } )
-t.insert( { x : 4 } )
-t.insert( { x : 7 } )
-t.insert( { x : 5 } )
-t.insert( { x : 6 } )
+t.insert( { x : 1 } );
+t.insert( { x : 10 } );
+t.insert( { x : 2 } );
+t.insert( { x : 9 } );
+t.insert( { x : 3 } );
+t.insert( { x : 8 } );
+t.insert( { x : 4 } );
+t.insert( { x : 7 } );
+t.insert( { x : 5 } );
+t.insert( { x : 6 } );
m = function(){
- emit( "a" , this.x )
-}
+ emit( "a" , this.x );
+};
r = function( k , v ){
- return Array.sum( v )
-}
+ return Array.sum( v );
+};
res = t.mapReduce( m , r , "mr_sort_out " );
x = res.convertToSingleObject();
res.drop();
-assert.eq( { "a" : 55 } , x , "A1" )
+assert.eq( { "a" : 55 } , x , "A1" );
-res = t.mapReduce( m , r , { out : "mr_sort_out" , query : { x : { $lt : 3 } } } )
+res = t.mapReduce( m , r , { out : "mr_sort_out" , query : { x : { $lt : 3 } } } );
x = res.convertToSingleObject();
res.drop();
-assert.eq( { "a" : 3 } , x , "A2" )
+assert.eq( { "a" : 3 } , x , "A2" );
res = t.mapReduce( m , r , { out : "mr_sort_out" , sort : { x : 1 } , limit : 2 } );
x = res.convertToSingleObject();
res.drop();
-assert.eq( { "a" : 3 } , x , "A3" )
+assert.eq( { "a" : 3 } , x , "A3" );
diff --git a/jstests/core/mr_stored.js b/jstests/core/mr_stored.js
index 7963d9892e1..3403411ea70 100644
--- a/jstests/core/mr_stored.js
+++ b/jstests/core/mr_stored.js
@@ -2,65 +2,65 @@
t = db.mr_stored;
t.drop();
-t.save( { "partner" : 1, "visits" : 9 } )
-t.save( { "partner" : 2, "visits" : 9 } )
-t.save( { "partner" : 1, "visits" : 11 } )
-t.save( { "partner" : 1, "visits" : 30 } )
-t.save( { "partner" : 2, "visits" : 41 } )
-t.save( { "partner" : 2, "visits" : 41 } )
+t.save( { "partner" : 1, "visits" : 9 } );
+t.save( { "partner" : 2, "visits" : 9 } );
+t.save( { "partner" : 1, "visits" : 11 } );
+t.save( { "partner" : 1, "visits" : 30 } );
+t.save( { "partner" : 2, "visits" : 41 } );
+t.save( { "partner" : 2, "visits" : 41 } );
m = function(obj){
- emit( obj.partner , { stats : [ obj.visits ] } )
-}
+ emit( obj.partner , { stats : [ obj.visits ] } );
+};
r = function( k , v ){
var stats = [];
var total = 0;
for ( var i=0; i<v.length; i++ ){
for ( var j in v[i].stats ) {
- stats.push( v[i].stats[j] )
+ stats.push( v[i].stats[j] );
total += v[i].stats[j];
}
}
- return { stats : stats , total : total }
-}
+ return { stats : stats , total : total };
+};
// Test that map reduce works with stored javascript
-db.system.js.save( { _id : "mr_stored_map" , value : m } )
-db.system.js.save( { _id : "mr_stored_reduce" , value : r } )
+db.system.js.save( { _id : "mr_stored_map" , value : m } );
+db.system.js.save( { _id : "mr_stored_reduce" , value : r } );
-res = t.mapReduce( function () { mr_stored_map(this) } ,
- function ( k , v ) { return mr_stored_reduce( k , v ) } ,
+res = t.mapReduce( function () { mr_stored_map(this); } ,
+ function ( k , v ) { return mr_stored_reduce( k , v ); } ,
{ out : "mr_stored_out" , scope : { xx : 1 } } );
//res.find().forEach( printjson )
-z = res.convertToSingleObject()
-assert.eq( 2 , Object.keySet( z ).length , "A1" )
-assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "A2" )
-assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "A3" )
+z = res.convertToSingleObject();
+assert.eq( 2 , Object.keySet( z ).length , "A1" );
+assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "A2" );
+assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "A3" );
-res.drop()
+res.drop();
m = function(obj){
var x = "partner";
var y = "visits";
- emit( obj[x] , { stats : [ obj[y] ] } )
-}
+ emit( obj[x] , { stats : [ obj[y] ] } );
+};
-db.system.js.save( { _id : "mr_stored_map" , value : m } )
+db.system.js.save( { _id : "mr_stored_map" , value : m } );
-res = t.mapReduce( function () { mr_stored_map(this) } ,
- function ( k , v ) { return mr_stored_reduce( k , v ) } ,
+res = t.mapReduce( function () { mr_stored_map(this); } ,
+ function ( k , v ) { return mr_stored_reduce( k , v ); } ,
{ out : "mr_stored_out" , scope : { xx : 1 } } );
//res.find().forEach( printjson )
-z = res.convertToSingleObject()
-assert.eq( 2 , Object.keySet( z ).length , "B1" )
-assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B2" )
-assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B3" )
+z = res.convertToSingleObject();
+assert.eq( 2 , Object.keySet( z ).length , "B1" );
+assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B2" );
+assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B3" );
-db.system.js.remove( { _id : "mr_stored_map" } )
-db.system.js.remove( { _id : "mr_stored_reduce" } )
+db.system.js.remove( { _id : "mr_stored_map" } );
+db.system.js.remove( { _id : "mr_stored_reduce" } );
-res.drop()
+res.drop();
diff --git a/jstests/core/mr_undef.js b/jstests/core/mr_undef.js
index e162f99836b..1bf89e3acc2 100644
--- a/jstests/core/mr_undef.js
+++ b/jstests/core/mr_undef.js
@@ -1,22 +1,22 @@
-t = db.mr_undef
-t.drop()
+t = db.mr_undef;
+t.drop();
-outname = "mr_undef_out"
-out = db[outname]
-out.drop()
+outname = "mr_undef_out";
+out = db[outname];
+out.drop();
-t.insert({x : 0})
+t.insert({x : 0});
-var m = function() { emit(this.mod, this.x); }
-var r = function(k,v) { total = 0; for(i in v) { total+= v[i]; } return total; }
+var m = function() { emit(this.mod, this.x); };
+var r = function(k,v) { total = 0; for(i in v) { total+= v[i]; } return total; };
-res = t.mapReduce(m, r, {out : outname } )
+res = t.mapReduce(m, r, {out : outname } );
-assert.eq( 0 , out.find( { _id : { $type : 6 } } ).itcount() , "A1" )
-assert.eq( 1 , out.find( { _id : { $type : 10 } } ).itcount() , "A2" )
+assert.eq( 0 , out.find( { _id : { $type : 6 } } ).itcount() , "A1" );
+assert.eq( 1 , out.find( { _id : { $type : 10 } } ).itcount() , "A2" );
-x = out.findOne()
-assert.eq( x , out.findOne( { _id : x["_id"] } ) , "A3" )
+x = out.findOne();
+assert.eq( x , out.findOne( { _id : x["_id"] } ) , "A3" );
diff --git a/jstests/core/nan.js b/jstests/core/nan.js
index f2c0421106b..046601d7acd 100644
--- a/jstests/core/nan.js
+++ b/jstests/core/nan.js
@@ -43,7 +43,7 @@ var testNaNComparisons = function() {
cursor = t.find({a: {$gte: NaN}});
assert.eq(5, cursor.next()["_id"]);
assert(!cursor.hasNext());
-}
+};
// Unindexed
testNaNComparisons();
diff --git a/jstests/core/nin.js b/jstests/core/nin.js
index 06582781591..7a25afd382e 100644
--- a/jstests/core/nin.js
+++ b/jstests/core/nin.js
@@ -50,7 +50,7 @@ doTest = function( n ) {
t.save( { a: { b: [ 20, 30 ] } } );
assert.eq( 1, t.find( { 'a.b': { $all: [ 20 ] } } ).count() , n + " O" );
assert.eq( 1, t.find( { 'a.b': { $all: [ 20, 30 ] } } ).count() , n + " P" );
-}
+};
doTest( "no index" );
t.drop();
diff --git a/jstests/core/no_db_created.js b/jstests/core/no_db_created.js
index 286aaa45d89..3c10dbc5772 100644
--- a/jstests/core/no_db_created.js
+++ b/jstests/core/no_db_created.js
@@ -2,7 +2,7 @@
(function() {
"use strict";
- var adminDB = db.getSiblingDB("admin")
+ var adminDB = db.getSiblingDB("admin");
var noDB = function(db) {
var dbName = db.getName();
var dbsRes = assert.commandWorked(adminDB.runCommand("listDatabases"));
@@ -10,9 +10,9 @@
assert.neq(dbName,
e.name,
"Found db which shouldn't exist:" + dbName + "; " + tojson(dbsRes));
- })
- }
- var mydb = db.getSiblingDB("neverCreated")
+ });
+ };
+ var mydb = db.getSiblingDB("neverCreated");
mydb.dropDatabase();
noDB(mydb);
diff --git a/jstests/core/not1.js b/jstests/core/not1.js
index f99a8490170..6ff509f8d80 100644
--- a/jstests/core/not1.js
+++ b/jstests/core/not1.js
@@ -3,9 +3,9 @@ t = db.not1;
t.drop();
-t.insert({a:1})
-t.insert({a:2})
-t.insert({})
+t.insert({a:1});
+t.insert({a:2});
+t.insert({});
function test( name ){
assert.eq( 3 , t.find().count() , name + "A" );
diff --git a/jstests/core/not2.js b/jstests/core/not2.js
index 239ea89d226..43dbfb20e3e 100644
--- a/jstests/core/not2.js
+++ b/jstests/core/not2.js
@@ -9,7 +9,7 @@ check = function( query, expected, size ) {
if ( size > 0 ) {
assert.eq( expected, t.findOne( query ).i, tojson( query ) );
}
-}
+};
fail = function( query ) {
try {
@@ -18,7 +18,7 @@ fail = function( query ) {
} catch ( e ) {
// expected
}
-}
+};
doTest = function() {
@@ -77,7 +77,7 @@ t.save( {i:[{j:"b"}]} );
check( {i:{$not:{$elemMatch:{j:"a"}}}}, [{j:"b"}] );
check( {i:{$not:{$elemMatch:{j:"f"}}}}, [{j:"a"}], 2 );
-}
+};
doTest();
t.ensureIndex( {i:1} );
diff --git a/jstests/core/null2.js b/jstests/core/null2.js
index 17b1a392714..841c26ac22f 100644
--- a/jstests/core/null2.js
+++ b/jstests/core/null2.js
@@ -19,7 +19,7 @@ function doQuery( query ) {
}
function getIds( query ) {
- var ids = []
+ var ids = [];
t.find( query ).forEach(
function(z) {
ids.push( z._id );
@@ -35,7 +35,7 @@ for ( var i=0; i < theQueries.length; 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] ) );
diff --git a/jstests/core/numberint.js b/jstests/core/numberint.js
index 86550f06214..f786a515c29 100644
--- a/jstests/core/numberint.js
+++ b/jstests/core/numberint.js
@@ -6,7 +6,7 @@ assert.eq.automsg( "4", "n.toNumber()" );
assert.eq.automsg( "8", "n + 4" );
assert.eq.automsg( "'NumberInt(4)'", "n.toString()" );
assert.eq.automsg( "'NumberInt(4)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberInt(4) }'", "p" );
@@ -20,7 +20,7 @@ assert.eq.automsg( "-4", "n.toNumber()" );
assert.eq.automsg( "0", "n + 4" );
assert.eq.automsg( "'NumberInt(-4)'", "n.toString()" );
assert.eq.automsg( "'NumberInt(-4)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberInt(-4) }'", "p" );
@@ -28,7 +28,7 @@ assert.eq.automsg( "'{ \"a\" : NumberInt(-4) }'", "p" );
n = new NumberInt( "11111" );
assert.eq.automsg( "'NumberInt(11111)'", "n.toString()" );
assert.eq.automsg( "'NumberInt(11111)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberInt(11111) }'", "p" );
@@ -41,7 +41,7 @@ assert.eq.automsg( "-11111", "n.toNumber()" );
assert.eq.automsg( "-11107", "n + 4" );
assert.eq.automsg( "'NumberInt(-11111)'", "n.toString()" );
assert.eq.automsg( "'NumberInt(-11111)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberInt(-11111) }'", "p" );
diff --git a/jstests/core/numberlong.js b/jstests/core/numberlong.js
index f0e3588890e..4f1d27d6cb0 100644
--- a/jstests/core/numberlong.js
+++ b/jstests/core/numberlong.js
@@ -6,7 +6,7 @@ assert.eq.automsg( "4", "n.toNumber()" );
assert.eq.automsg( "8", "n + 4" );
assert.eq.automsg( "'NumberLong(4)'", "n.toString()" );
assert.eq.automsg( "'NumberLong(4)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberLong(4) }'", "p" );
@@ -20,7 +20,7 @@ assert.eq.automsg( "-4", "n.toNumber()" );
assert.eq.automsg( "0", "n + 4" );
assert.eq.automsg( "'NumberLong(-4)'", "n.toString()" );
assert.eq.automsg( "'NumberLong(-4)'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberLong(-4) }'", "p" );
@@ -31,7 +31,7 @@ assert.eq.automsg( "11111111111111112", "n.toNumber()" );
assert.eq.automsg( "11111111111111116", "n + 4" );
assert.eq.automsg( "'NumberLong(\"11111111111111111\")'", "n.toString()" );
assert.eq.automsg( "'NumberLong(\"11111111111111111\")'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberLong(\"11111111111111111\") }'", "p" );
@@ -44,7 +44,7 @@ assert.eq.automsg( "-11111111111111112", "n.toNumber()" );
assert.eq.automsg( "-11111111111111108", "n + 4" );
assert.eq.automsg( "'NumberLong(\"-11111111111111111\")'", "n.toString()" );
assert.eq.automsg( "'NumberLong(\"-11111111111111111\")'", "tojson( n )" );
-a = {}
+a = {};
a.a = n;
p = tojson( a );
assert.eq.automsg( "'{ \"a\" : NumberLong(\"-11111111111111111\") }'", "p" );
diff --git a/jstests/core/numberlong3.js b/jstests/core/numberlong3.js
index 10036c0544e..b8a8c9c468e 100644
--- a/jstests/core/numberlong3.js
+++ b/jstests/core/numberlong3.js
@@ -12,7 +12,7 @@ for( i = 10; i >= 0; --i ) {
}
}
-ret = t.find().sort({x:1}).toArray().filter( function( x ) { return typeof( x.x.floatApprox ) != 'undefined' } );
+ret = t.find().sort({x:1}).toArray().filter( function( x ) { return typeof( x.x.floatApprox ) != 'undefined'; } );
//printjson( ret );
diff --git a/jstests/core/objid1.js b/jstests/core/objid1.js
index dea31eed0d8..f1a9fbe0fbd 100644
--- a/jstests/core/objid1.js
+++ b/jstests/core/objid1.js
@@ -7,7 +7,7 @@ assert( b.str , "A" );
a = new ObjectId( b.str );
assert.eq( a.str , b.str , "B" );
-t.save( { a : a } )
+t.save( { a : a } );
assert( t.findOne().a.isObjectId , "C" );
assert.eq( a.str , t.findOne().a.str , "D" );
diff --git a/jstests/core/objid2.js b/jstests/core/objid2.js
index a28c18fca15..0805dffced7 100644
--- a/jstests/core/objid2.js
+++ b/jstests/core/objid2.js
@@ -1,7 +1,7 @@
t = db.objid2;
t.drop();
-t.save( { _id : 517 , a : "hello" } )
+t.save( { _id : 517 , a : "hello" } );
assert.eq( t.findOne().a , "hello" );
assert.eq( t.findOne()._id , 517 );
diff --git a/jstests/core/objid4.js b/jstests/core/objid4.js
index 23986b95c71..1ae55a558f2 100644
--- a/jstests/core/objid4.js
+++ b/jstests/core/objid4.js
@@ -6,11 +6,11 @@ assert( o.str );
a = new ObjectId( o.str );
assert.eq( o.str , a.str );
-assert.eq( a.str , a.str.toString() )
+assert.eq( a.str , a.str.toString() );
b = ObjectId( o.str );
assert.eq( o.str , b.str );
-assert.eq( b.str , b.str.toString() )
+assert.eq( b.str , b.str.toString() );
assert.throws( function(z){ return new ObjectId( "a" ); } );
assert.throws( function(z){ return new ObjectId( "12345678901234567890123z" ); } );
diff --git a/jstests/core/objid5.js b/jstests/core/objid5.js
index f85ebc8c71d..6189032df6e 100644
--- a/jstests/core/objid5.js
+++ b/jstests/core/objid5.js
@@ -5,15 +5,15 @@ t.drop();
t.save( { _id : 5.5 } );
assert.eq( 18 , Object.bsonsize( t.findOne() ) , "A" );
-x = db.runCommand( { features : 1 } )
-y = db.runCommand( { features : 1 , oidReset : 1 } )
+x = db.runCommand( { features : 1 } );
+y = db.runCommand( { features : 1 , oidReset : 1 } );
if( !x.ok )
print("x: " + tojson(x));
-assert( x.oidMachine , "B1" )
-assert.neq( x.oidMachine , y.oidMachine , "B2" )
-assert.eq( x.oidMachine , y.oidMachineOld , "B3" )
+assert( x.oidMachine , "B1" );
+assert.neq( x.oidMachine , y.oidMachine , "B2" );
+assert.eq( x.oidMachine , y.oidMachineOld , "B3" );
-assert.eq( 18 , Object.bsonsize( { _id : 7.7 } ) , "C1" )
-assert.eq( 0 , Object.bsonsize( null ) , "C2" )
+assert.eq( 18 , Object.bsonsize( { _id : 7.7 } ) , "C1" );
+assert.eq( 0 , Object.bsonsize( null ) , "C2" );
diff --git a/jstests/core/objid7.js b/jstests/core/objid7.js
index 5a5ca728c7d..520289c8c37 100644
--- a/jstests/core/objid7.js
+++ b/jstests/core/objid7.js
@@ -1,12 +1,12 @@
-a = new ObjectId( "4c1a478603eba73620000000" )
-b = new ObjectId( "4c1a478603eba73620000000" )
+a = new ObjectId( "4c1a478603eba73620000000" );
+b = new ObjectId( "4c1a478603eba73620000000" );
c = new ObjectId();
-assert.eq( a.toString() , b.toString() , "A" )
+assert.eq( a.toString() , b.toString() , "A" );
assert.eq( a.toString() , "ObjectId(\"4c1a478603eba73620000000\")" , "B" );
-assert( a.equals( b ) , "C" )
+assert( a.equals( b ) , "C" );
assert.neq( a.toString() , c.toString() , "D" );
assert( ! a.equals( c ) , "E" );
diff --git a/jstests/core/opcounters_active.js b/jstests/core/opcounters_active.js
index cf093103f47..56330cbbebc 100644
--- a/jstests/core/opcounters_active.js
+++ b/jstests/core/opcounters_active.js
@@ -38,15 +38,15 @@
//Test that the serverstatus helper works
var result = db.serverStatus();
- assert.neq(undefined, result, result)
+ assert.neq(undefined, result, result);
//Test that the metrics tree returns
- assert.neq(undefined, result.metrics, result)
+ assert.neq(undefined, result.metrics, result);
//Test that the metrics.commands tree returns
- assert.neq(undefined, result.metrics.commands, result)
+ assert.neq(undefined, result.metrics.commands, result);
//Test that the metrics.commands.serverStatus value is non-zero
- assert.neq(0, result.metrics.commands.serverStatus.total, result)
+ assert.neq(0, result.metrics.commands.serverStatus.total, result);
//Test that the command returns successfully when no metrics tree is present
- var result = db.serverStatus({"metrics":0})
- assert.eq(undefined, result.metrics, result)
+ var result = db.serverStatus({"metrics":0});
+ assert.eq(undefined, result.metrics, result);
}()); \ No newline at end of file
diff --git a/jstests/core/opcounters_write_cmd.js b/jstests/core/opcounters_write_cmd.js
index 4fd1c4ed34b..660b82bd501 100644
--- a/jstests/core/opcounters_write_cmd.js
+++ b/jstests/core/opcounters_write_cmd.js
@@ -33,7 +33,7 @@ assert.eq(opCounters.insert + 1, newdb.serverStatus().opcounters.insert);
// Bulk insert, no error.
opCounters = newdb.serverStatus().opcounters;
-res = t.insert([{_id:1},{_id:2}])
+res = t.insert([{_id:1},{_id:2}]);
assert.writeOK(res);
assert.eq(opCounters.insert + 2, newdb.serverStatus().opcounters.insert);
@@ -42,20 +42,20 @@ assert.eq(opCounters.insert + 2, newdb.serverStatus().opcounters.insert);
if (t.getMongo().writeMode() != "compatibility"){
// Single insert, with error.
opCounters = newdb.serverStatus().opcounters;
- res = t.insert({_id:0})
+ res = t.insert({_id:0});
assert.writeError(res);
assert.eq(opCounters.insert + 1, newdb.serverStatus().opcounters.insert);
// Bulk insert, with error, ordered.
opCounters = newdb.serverStatus().opcounters;
- res = t.insert([{_id:3},{_id:3},{_id:4}])
+ res = t.insert([{_id:3},{_id:3},{_id:4}]);
assert.writeError(res);
assert.eq(opCounters.insert + 2, newdb.serverStatus().opcounters.insert);
// Bulk insert, with error, unordered.
var continueOnErrorFlag = 1;
opCounters = newdb.serverStatus().opcounters;
- res = t.insert([{_id:5},{_id:5},{_id:6}], continueOnErrorFlag)
+ res = t.insert([{_id:5},{_id:5},{_id:6}], continueOnErrorFlag);
assert.writeError(res);
assert.eq(opCounters.insert + 3, newdb.serverStatus().opcounters.insert);
}
@@ -113,7 +113,7 @@ assert.eq(opCounters.query + 1, newdb.serverStatus().opcounters.query);
// Query, with error.
opCounters = newdb.serverStatus().opcounters;
-assert.throws(function() { t.findOne({_id:{$invalidOp:1}}) });
+assert.throws(function() { t.findOne({_id:{$invalidOp:1}}); });
assert.eq(opCounters.query + 1, newdb.serverStatus().opcounters.query);
//
@@ -142,12 +142,12 @@ assert.eq(opCounters.getmore + 1, newdb.serverStatus().opcounters.getmore);
//
t.drop();
-t.insert({_id:0})
+t.insert({_id:0});
// Command, recognized, no error.
serverStatus = newdb.runCommand({serverStatus: 1});
-opCounters = serverStatus.opcounters
-metricsObj = serverStatus.metrics.commands
+opCounters = serverStatus.opcounters;
+metricsObj = serverStatus.metrics.commands;
assert.eq(opCounters.command + 1, newdb.serverStatus().opcounters.command); // "serverStatus" counted
// Count this and the last run of "serverStatus"
assert.eq(metricsObj.serverStatus.total + 2,
@@ -160,7 +160,7 @@ assert.eq(metricsObj.serverStatus.failed,
// Command, recognized, with error.
countVal = { "total" : 0, "failed" : 0 };
if (metricsObj.count != null) {
- countVal = metricsObj.count
+ countVal = metricsObj.count;
}
res = t.runCommand("count", {query:{$invalidOp:1}}); // "count command" counted
assert.eq(0, res.ok);
diff --git a/jstests/core/or1.js b/jstests/core/or1.js
index 0153afe9115..cc6d7aa37e8 100644
--- a/jstests/core/or1.js
+++ b/jstests/core/or1.js
@@ -10,7 +10,7 @@ checkArrs = function( a, b ) {
for ( i = 0; i < aStr.length; ++i ) {
assert.neq( -1, bStr.indexOf( aStr[ i ] ) );
}
-}
+};
doTest = function() {
@@ -39,7 +39,7 @@ assert.eq( 1, t.find( { $or: [ { a: {$in:[0,1]}} ] } ).toArray().length );
assert.eq( 1, t.find( { $or: [ { b: {$in:[0,1]}} ] } ).toArray().length );
assert.eq( 1, t.find( { $or: [ { a: {$in:[0,1]}}, { b: {$in:[0,1]}} ] } ).toArray().length );
-}
+};
doTest();
diff --git a/jstests/core/or2.js b/jstests/core/or2.js
index cbbf51c0eaf..11cfc44ff7f 100644
--- a/jstests/core/or2.js
+++ b/jstests/core/or2.js
@@ -13,7 +13,7 @@ checkArrs = function( a, b ) {
for ( i = 0; i < aStr.length; ++i ) {
assert.neq( -1, bStr.indexOf( aStr[ i ] ) );
}
-}
+};
doTest = function( index ) {
if ( index == null ) {
@@ -54,7 +54,7 @@ doTest = function( index ) {
t.update( {x:10,$or:[ {a:2} ]}, {$set:{'a.$':100}} );
assert.eq( obj, t.findOne() ); // no change
*/
-}
+};
doTest( false );
diff --git a/jstests/core/or3.js b/jstests/core/or3.js
index 293a3f37164..1ca0ac29d80 100644
--- a/jstests/core/or3.js
+++ b/jstests/core/or3.js
@@ -13,7 +13,7 @@ checkArrs = function( a, b ) {
for ( i = 0; i < aStr.length; ++i ) {
assert.neq( -1, bStr.indexOf( aStr[ i ] ) );
}
-}
+};
doTest = function( index ) {
if ( index == null ) {
@@ -46,7 +46,7 @@ doTest = function( index ) {
an1b2 = t.find( { $nor: [ { a : 1 } ], $or: [ { b : 2 } ] } ).toArray();
checkArrs( t.find( {a:{$ne:1},b:2} ).toArray(), an1b2 );
-}
+};
doTest( false );
diff --git a/jstests/core/or4.js b/jstests/core/or4.js
index 02242b379fe..a02150ff1d0 100644
--- a/jstests/core/or4.js
+++ b/jstests/core/or4.js
@@ -13,7 +13,7 @@ checkArrs = function( a, b ) {
for ( i = 0; i < aStr.length; ++i ) {
assert( -1 != bStr.indexOf( aStr[ i ] ), m );
}
-}
+};
t.ensureIndex( {a:1} );
t.ensureIndex( {b:1} );
diff --git a/jstests/core/ore.js b/jstests/core/ore.js
index f938f635d41..93538f8b46b 100644
--- a/jstests/core/ore.js
+++ b/jstests/core/ore.js
@@ -4,7 +4,7 @@
t = db.jstests_ore;
t.drop();
-t.ensureIndex( {a:-1} )
+t.ensureIndex( {a:-1} );
t.ensureIndex( {b:1} );
t.save( {a:1,b:1} );
diff --git a/jstests/core/oro.js b/jstests/core/oro.js
index ae1b6f53552..d93bfa6dd09 100644
--- a/jstests/core/oro.js
+++ b/jstests/core/oro.js
@@ -5,7 +5,7 @@ t.drop();
orClauses = [];
for( idxKey = 'a'; idxKey <= 'aaaaaaaaaa'; idxKey += 'a' ) {
- idx = {}
+ idx = {};
idx[ idxKey ] = 1;
t.ensureIndex( idx );
for( i = 0; i < 200; ++i ) {
diff --git a/jstests/core/plan_cache_shell_helpers.js b/jstests/core/plan_cache_shell_helpers.js
index 9ac9554ef00..c22e0e451eb 100644
--- a/jstests/core/plan_cache_shell_helpers.js
+++ b/jstests/core/plan_cache_shell_helpers.js
@@ -83,7 +83,7 @@ assert.eq(0, planCache.getPlansByQuery({unknownfield: 1}).length,
'collection.getPlanCache().getPlansByQuery() should return empty results ' +
'on non-existent collection');
// should error on missing required field query.
-assert.throws(function() { planCache.getPlansByQuery() });
+assert.throws(function() { planCache.getPlansByQuery(); });
// Invoke with various permutations of required (query) and optional (projection, sort) arguments.
assert.eq(getPlans(queryB, sortC, projectionB), planCache.getPlansByQuery(queryB, projectionB,
@@ -131,7 +131,7 @@ assert.eq(0, planCache.getPlansByQuery({query: queryB, sort: sortC,
// should not error on non-existent query shape.
planCache.clearPlansByQuery({unknownfield: 1});
// should error on missing required field query.
-assert.throws(function() { planCache.clearPlansByQuery() });
+assert.throws(function() { planCache.clearPlansByQuery(); });
// Invoke with various permutations of required (query) and optional (projection, sort) arguments.
planCache.clearPlansByQuery(queryB, projectionB);
diff --git a/jstests/core/profile1.js b/jstests/core/profile1.js
index 217ffdc2e50..4fe9993116f 100644
--- a/jstests/core/profile1.js
+++ b/jstests/core/profile1.js
@@ -4,7 +4,7 @@
query = query || {};
Object.extend(query, {user:username + "@" + db.getName()});
return db.system.profile.find(query);
- };
+ }
function getProfileAString() {
var s = "\n";
@@ -12,20 +12,20 @@
s += tojson(z) + " ,\n";
});
return s;
- };
+ }
function resetProfile(level, slowms) {
db.setProfilingLevel(0);
db.system.profile.drop();
db.setProfilingLevel(level,slowms);
- };
+ }
// special db so that it can be run in parallel tests
var stddb = db;
db = db.getSisterDB("profile1");
var username = "jstests_profile1_user";
- db.dropUser(username)
+ db.dropUser(username);
db.dropDatabase();
try {
@@ -46,7 +46,7 @@
assert.eq(2, db.runCommand({profile: -1}).was, "B");
assert.eq(1, db.system.profile.stats().capped, "C");
- db.foo.findOne()
+ db.foo.findOne();
var profileItems = profileCursor().toArray();
diff --git a/jstests/core/profile3.js b/jstests/core/profile3.js
index 0e1a731f41d..96b2314ab87 100644
--- a/jstests/core/profile3.js
+++ b/jstests/core/profile3.js
@@ -12,7 +12,7 @@ profileCursor = function( query ) {
query = query || {};
Object.extend( query, { user: username + "@" + db.getName() } );
return db.system.profile.find( query );
-}
+};
try {
username = "jstests_profile3_user";
@@ -22,7 +22,7 @@ try {
db.setProfilingLevel(0);
db.system.profile.drop();
- assert.eq( 0 , profileCursor().count() )
+ assert.eq( 0 , profileCursor().count() );
db.setProfilingLevel(2);
@@ -34,14 +34,14 @@ try {
t.update( { x : 1 }, {$inc:{a:1}} );
t.update( { x : 0 }, {$inc:{a:1}} );
- profileCursor().forEach( printjson )
+ profileCursor().forEach( printjson );
db.setProfilingLevel(0);
- assert.eq(profileCursor({nMatched: {$exists:1}}).count(), 3)
- assert.eq(profileCursor({nMatched: 1}).count(), 2)
- assert.eq(profileCursor({nMatched: 0}).count(), 1)
+ assert.eq(profileCursor({nMatched: {$exists:1}}).count(), 3);
+ assert.eq(profileCursor({nMatched: 1}).count(), 2);
+ assert.eq(profileCursor({nMatched: 0}).count(), 1);
if ( db.serverStatus().storageEngine.name == "mmapv1" ) {
assert.eq(profileCursor({nmoved: 1}).count(), 1 );
}
diff --git a/jstests/core/profile4.js b/jstests/core/profile4.js
index 615aa779f2e..8dd722f4406 100644
--- a/jstests/core/profile4.js
+++ b/jstests/core/profile4.js
@@ -61,7 +61,7 @@ try {
coll.save({});
coll.find().skip(1).limit(4).itcount();
lastOp = getLastOp();
- assert.eq(lastOp.query.skip, 1)
+ assert.eq(lastOp.query.skip, 1);
assert.eq(lastOp.docsExamined, 3);
assert.eq(lastOp.nreturned, 2);
// Find command will use "limit", OP_QUERY will use ntoreturn.
@@ -166,8 +166,8 @@ try {
assert("getMore" in lastOp.query);
assert.eq(lastOp.query.getMore, lastOp.cursorid);
assert.eq(lastOp.query.collection, coll.getName());
- assert.eq(lastOp.query.batchSize, 3)
- assert.eq(lastOp.cursorExhausted, true)
+ assert.eq(lastOp.query.batchSize, 3);
+ assert.eq(lastOp.cursorExhausted, true);
assert.eq(lastOp.nreturned, 2);
assert("responseLength" in lastOp);
diff --git a/jstests/core/proj_key1.js b/jstests/core/proj_key1.js
index c0720ed0fcb..264c941192f 100644
--- a/jstests/core/proj_key1.js
+++ b/jstests/core/proj_key1.js
@@ -2,16 +2,16 @@
t = db.proj_key1;
t.drop();
-as = []
+as = [];
for ( i=0; i<10; i++ ){
- as.push( { a : i } )
+ as.push( { a : i } );
t.insert( { a : i , b : i } );
}
-t.ensureIndex( { a : 1 } )
+t.ensureIndex( { a : 1 } );
// assert( t.find( {} , { a : 1 , _id : 0 } ).explain().indexOnly , "A4" ); // TODO: need to modify query optimier SERVER-2109
-assert.eq( as , t.find( { a : { $gte : 0 } } , { a : 1 , _id : 0 } ).toArray() , "B1" )
-assert.eq( as , t.find( { a : { $gte : 0 } } , { a : 1 , _id : 0 } ).batchSize(2).toArray() , "B1" )
+assert.eq( as , t.find( { a : { $gte : 0 } } , { a : 1 , _id : 0 } ).toArray() , "B1" );
+assert.eq( as , t.find( { a : { $gte : 0 } } , { a : 1 , _id : 0 } ).batchSize(2).toArray() , "B1" );
diff --git a/jstests/core/pull.js b/jstests/core/pull.js
index 3cb6328e2de..392d8bec227 100644
--- a/jstests/core/pull.js
+++ b/jstests/core/pull.js
@@ -20,7 +20,7 @@ assert.eq( [], t.findOne().a );
// SERVER-6047: $pull creates empty nested docs for dotted fields
// that don't exist.
-t.drop()
+t.drop();
t.save({ m : 1 } );
t.update( { m : 1 }, { $pull : { 'a.b' : [ 1 ] } } );
assert( ('a' in t.findOne()) == false );
diff --git a/jstests/core/pull2.js b/jstests/core/pull2.js
index ca13fc2e726..b5a4f8f9870 100644
--- a/jstests/core/pull2.js
+++ b/jstests/core/pull2.js
@@ -8,24 +8,24 @@ assert.eq( 2 , t.findOne().a.length , "A" );
t.update( {} , { $pull : { a : { x : 1 } } } );
assert.eq( 0 , t.findOne().a.length , "B" );
-assert.eq( 1 , t.find().count() , "C1" )
+assert.eq( 1 , t.find().count() , "C1" );
-t.update( {} , { $push : { a : { x : 1 } } } )
-t.update( {} , { $push : { a : { x : 1 , b : 2 } } } )
+t.update( {} , { $push : { a : { x : 1 } } } );
+t.update( {} , { $push : { a : { x : 1 , b : 2 } } } );
assert.eq( 2 , t.findOne().a.length , "C" );
t.update( {} , { $pullAll : { a : [ { x : 1 } ] } } );
assert.eq( 1 , t.findOne().a.length , "D" );
-t.update( {} , { $push : { a : { x : 2 , b : 2 } } } )
-t.update( {} , { $push : { a : { x : 3 , b : 2 } } } )
-t.update( {} , { $push : { a : { x : 4 , b : 2 } } } )
+t.update( {} , { $push : { a : { x : 2 , b : 2 } } } );
+t.update( {} , { $push : { a : { x : 3 , b : 2 } } } );
+t.update( {} , { $push : { a : { x : 4 , b : 2 } } } );
assert.eq( 4 , t.findOne().a.length , "E" );
-assert.eq( 1 , t.find().count() , "C2" )
+assert.eq( 1 , t.find().count() , "C2" );
t.update( {} , { $pull : { a : { x : { $lt : 3 } } } } );
assert.eq( 2 , t.findOne().a.length , "F" );
-assert.eq( [ 3 , 4 ] , t.findOne().a.map( function(z){ return z.x; } ) , "G" )
+assert.eq( [ 3 , 4 ] , t.findOne().a.map( function(z){ return z.x; } ) , "G" );
diff --git a/jstests/core/pull_remove1.js b/jstests/core/pull_remove1.js
index 379f3f2832b..90460eb2d6e 100644
--- a/jstests/core/pull_remove1.js
+++ b/jstests/core/pull_remove1.js
@@ -1,14 +1,14 @@
-t = db.pull_remove1
-t.drop()
+t = db.pull_remove1;
+t.drop();
-o = { _id : 1 , a : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] }
-t.insert( o )
+o = { _id : 1 , a : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] };
+t.insert( o );
-assert.eq( o , t.findOne() , "A1" )
+assert.eq( o , t.findOne() , "A1" );
-o.a = o.a.filter( function(z){ return z >= 6; } )
-t.update( {} , { $pull : { a : { $lt : 6 } } } )
+o.a = o.a.filter( function(z){ return z >= 6; } );
+t.update( {} , { $pull : { a : { $lt : 6 } } } );
-assert.eq( o.a , t.findOne().a , "A2" )
+assert.eq( o.a , t.findOne().a , "A2" );
diff --git a/jstests/core/pullall.js b/jstests/core/pullall.js
index 7dd932c4bbf..e66e8b10d35 100644
--- a/jstests/core/pullall.js
+++ b/jstests/core/pullall.js
@@ -18,7 +18,7 @@ assert.eq( [], t.findOne().a );
// SERVER-6047: $pullAll creates empty nested docs for dotted fields
// that don't exist.
-t.drop()
+t.drop();
t.save({ m : 1 } );
t.update( { m : 1 }, { $pullAll : { 'a.b' : [ 1 ] } } );
assert( ('a' in t.findOne()) == false );
diff --git a/jstests/core/pullall2.js b/jstests/core/pullall2.js
index 61369badaa4..c97c4e43aba 100644
--- a/jstests/core/pullall2.js
+++ b/jstests/core/pullall2.js
@@ -1,20 +1,20 @@
-t = db.pullall2
-t.drop()
+t = db.pullall2;
+t.drop();
-o = { _id : 1 , a : [] }
+o = { _id : 1 , a : [] };
for ( i=0; i<5; i++ )
- o.a.push( { x : i , y : i } )
+ o.a.push( { x : i , y : i } );
-t.insert( o )
+t.insert( o );
assert.eq( o , t.findOne() , "A" );
-t.update( {} , { $pull : { a : { x : 3 } } } )
-o.a = o.a.filter( function(z){ return z.x != 3 } )
+t.update( {} , { $pull : { a : { x : 3 } } } );
+o.a = o.a.filter( function(z){ return z.x != 3; } );
assert.eq( o , t.findOne() , "B" );
t.update( {} , { $pull : { a : { x : { $in : [ 1 , 4 ] } } } } );
-o.a = o.a.filter( function(z){ return z.x != 1 } )
-o.a = o.a.filter( function(z){ return z.x != 4 } )
+o.a = o.a.filter( function(z){ return z.x != 1; } );
+o.a = o.a.filter( function(z){ return z.x != 4; } );
assert.eq( o , t.findOne() , "C" );
diff --git a/jstests/core/push.js b/jstests/core/push.js
index 7e801c7a2af..cefccbb79d4 100644
--- a/jstests/core/push.js
+++ b/jstests/core/push.js
@@ -27,29 +27,29 @@ t.update( { _id : 2 } , { $pop : { a : -1 } } );
assert.eq( "4,5" , t.findOne().a.toString() , "E3" );
res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
assert.eq( "5" , t.findOne().a.toString() , "E4" );
res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
assert.eq( "" , t.findOne().a.toString() , "E5" );
res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
assert.eq( "" , t.findOne().a.toString() , "E6" );
res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
assert.eq( "" , t.findOne().a.toString() , "E7" );
res = t.update( { _id : 2 } , { $pop : { a : 1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
assert.eq( "" , t.findOne().a.toString() , "E8" );
res = t.update( { _id : 2 } , { $pop : { b : -1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
res = t.update( { _id : 2 } , { $pop : { b : 1 } } );
-assert.writeOK( res )
+assert.writeOK( res );
diff --git a/jstests/core/push2.js b/jstests/core/push2.js
index 2ce34b7bf9a..5161cc373b6 100644
--- a/jstests/core/push2.js
+++ b/jstests/core/push2.js
@@ -1,8 +1,8 @@
-t = db.push2
-t.drop()
+t = db.push2;
+t.drop();
-t.save( { _id : 1 , a : [] } )
+t.save( { _id : 1 , a : [] } );
s = new Array(700000).toString();
diff --git a/jstests/core/push_sort.js b/jstests/core/push_sort.js
index 3a0634a3ce5..9bbf5447ae6 100644
--- a/jstests/core/push_sort.js
+++ b/jstests/core/push_sort.js
@@ -12,40 +12,40 @@ t.drop();
// $slice amount is too large to kick in.
t.save( { _id: 1, x: [ {a:1}, {a:2} ] } );
-t.update( {_id:1}, { $push: { x: { $each: [ {a:3} ], $slice:-5, $sort: {a:1} } } } )
+t.update( {_id:1}, { $push: { x: { $each: [ {a:3} ], $slice:-5, $sort: {a:1} } } } );
assert.eq( [{a:1}, {a:2}, {a:3}] , t.findOne( {_id:1} ).x );
// $slice amount kicks in using values of both the base doc and of the $each clause.
t.save({ _id: 2, x: [ {a:1}, {a:3} ] } );
-t.update( {_id:2}, { $push: { x: { $each: [ {a:2} ], $slice:-2, $sort: {a:1} } } } )
+t.update( {_id:2}, { $push: { x: { $each: [ {a:2} ], $slice:-2, $sort: {a:1} } } } );
assert.eq( [{a:2}, {a:3}], t.findOne( {_id:2} ).x );
// $sort is descending and $slice is too large to kick in.
t.save({ _id: 3, x: [ {a:1}, {a:3} ] } );
-t.update( {_id:3}, { $push: { x: { $each: [ {a:2} ], $slice:-5, $sort: {a:-1} } } } )
+t.update( {_id:3}, { $push: { x: { $each: [ {a:2} ], $slice:-5, $sort: {a:-1} } } } );
assert.eq( [{a:3}, {a:2}, {a:1}], t.findOne( {_id:3} ).x );
// $sort is descending and $slice kicks in using values of both the base doc and of
// the $each clause.
t.save({ _id: 4, x: [ {a:1}, {a:3} ] } );
-t.update( {_id:4}, { $push: { x: { $each: [ {a:2} ], $slice:-2, $sort: {a:-1} } } } )
+t.update( {_id:4}, { $push: { x: { $each: [ {a:2} ], $slice:-2, $sort: {a:-1} } } } );
assert.eq( [{a:2}, {a:1}], t.findOne( {_id:4} ).x );
// $sort over only a portion of the array's elements objects and #slice kicking in
// using values of both the base doc and of the $each clause.
t.save({ _id: 5, x: [ {a:1,b:2}, {a:3,b:1} ] } );
-t.update( {_id:5}, { $push: { x: { $each: [ {a:2,b:3} ], $slice:-2, $sort: {b:1} } } } )
+t.update( {_id:5}, { $push: { x: { $each: [ {a:2,b:3} ], $slice:-2, $sort: {b:1} } } } );
assert.eq( [{a:1, b:2}, {a:2,b:3}], t.findOne( {_id:5} ).x );
// $sort over an array of nested objects and $slice too large to kick in.
t.save({ _id: 6, x: [ {a:{b:2}}, {a:{b:1}} ] } );
-t.update( {_id:6}, { $push: { x: { $each: [ {a:{b:3}} ], $slice:-5, $sort: {'a.b':1} } } } )
+t.update( {_id:6}, { $push: { x: { $each: [ {a:{b:3}} ], $slice:-5, $sort: {'a.b':1} } } } );
assert.eq( [{a:{b:1}}, {a:{b:2}}, {a:{b:3}}], t.findOne( {_id:6} ).x );
// $sort over an array of nested objects and $slice kicking in using values of both the
// base doc and of the $each clause.
t.save({ _id: 7, x: [ {a:{b:2}}, {a:{b:1}} ] } );
-t.update( {_id:7}, { $push: { x: { $each: [ {a:{b:3}} ], $slice:-2, $sort: {'a.b':1} } } } )
+t.update( {_id:7}, { $push: { x: { $each: [ {a:{b:3}} ], $slice:-2, $sort: {'a.b':1} } } } );
assert.eq( [{a:{b:2}}, {a:{b:3}}], t.findOne( {_id:7} ).x );
//
@@ -62,42 +62,42 @@ assert.docEq(t.findOne({_id:8}), doc8); //ensure doc was not changed
t.save({ _id: 100, x: [ {a:1} ] } );
// For now, elements of the $each vector need to be objects. In here, '2' is an invalide $each.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [ 2 ], $slice:-2, $sort:{a:1} } } } ) )
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [ 2 ], $slice:-2, $sort:{a:1} } } } ) );
// For the same reason as above, '1' is an invalid $each element.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2},1], $slice:-2, $sort:{a:1} } } }))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2},1], $slice:-2, $sort:{a:1} } } }));
// The sort key pattern cannot be empty.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort:{} } } } ) )
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort:{} } } } ) );
// For now, we do not support positive $slice's (ie, trimming from the array's front).
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:2, $sort: {a:1} } } }))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:2, $sort: {a:1} } } }));
// A $slice cannot be a fractional value.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2.1, $sort: {a:1} } }}))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2.1, $sort: {a:1} } }}));
// The sort key pattern's value must be either 1 or -1. In here, {a:-2} is an invalid value.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {a:-2} } } }))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {a:-2} } } }));
// For now, we are not supporting sorting of basic elements (non-object, non-arrays). In here,
// the $sort clause would need to have a key pattern value rather than 1.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: 1 } } } ) )
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: 1 } } } ) );
// The key pattern 'a.' is an invalid value for $sort.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {'a.':1} }}}))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {'a.':1} }}}));
// An empty key pattern is not a valid $sort value.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {'':1} } } }))
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {'':1} } } }));
// If a $slice is used, the only other $sort clause that's accepted is $sort. In here, $xxx
// is not a valid clause.
-assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $xxx: {s:1} } } } ) )
+assert.throws( t.update( {_id:100}, { $push: { x: { $each: [{a:2}], $slice:-2, $xxx: {s:1} } } } ) );
-t.remove({})
+t.remove({});
// Ensure that existing values are validated in the array as objects during a $sort with $each,
// not only the elements in the $each array.
t.save({ _id: 100, x: [ 1, "foo" ] } );
assert.throws(t.update(
{_id: 100},
- { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {a:1} } } } ) )
+ { $push: { x: { $each: [{a:2}], $slice:-2, $sort: {a:1} } } } ) );
diff --git a/jstests/core/query1.js b/jstests/core/query1.js
index 1f39380cbf5..78d70eb55fb 100644
--- a/jstests/core/query1.js
+++ b/jstests/core/query1.js
@@ -3,7 +3,7 @@ t = db.query1;
t.drop();
t.save( { num : 1 } );
-t.save( { num : 3 } )
+t.save( { num : 3 } );
t.save( { num : 4 } );
num = 0;
@@ -16,11 +16,11 @@ t.find().forEach(
}
);
-assert.eq( num , 3 , "num" )
-assert.eq( total , 8 , "total" )
+assert.eq( num , 3 , "num" );
+assert.eq( total , 8 , "total" );
-assert.eq( 3 , t.find().comment("this is a test").itcount() , "B1" )
-assert.eq( 3 , t.find().comment("this is a test").count() , "B2" )
+assert.eq( 3 , t.find().comment("this is a test").itcount() , "B1" );
+assert.eq( 3 , t.find().comment("this is a test").count() , "B2" );
-assert.eq( 3 , t.find().comment("yo ho ho").itcount() , "C1" )
-assert.eq( 3 , t.find().comment("this is a test").count() , "C2" )
+assert.eq( 3 , t.find().comment("yo ho ho").itcount() , "C1" );
+assert.eq( 3 , t.find().comment("this is a test").count() , "C2" );
diff --git a/jstests/core/queryoptimizera.js b/jstests/core/queryoptimizera.js
index f26c2b0978c..d705bf580ea 100644
--- a/jstests/core/queryoptimizera.js
+++ b/jstests/core/queryoptimizera.js
@@ -2,7 +2,7 @@
// constraint is printed at appropriate times. SERVER-5353
function numWarnings() {
- logs = db.adminCommand( { getLog:"global" } ).log
+ logs = db.adminCommand( { getLog:"global" } ).log;
ret = 0;
logs.forEach( function( x ) {
if ( x.match( warningMatchRegexp ) ) {
diff --git a/jstests/core/ref.js b/jstests/core/ref.js
index dd3370ad9b1..f519d796bad 100644
--- a/jstests/core/ref.js
+++ b/jstests/core/ref.js
@@ -21,7 +21,7 @@ assert( db.things.findOne().o.fetch().n == 2, "dbrefs broken" );
db.getSiblingDB("otherdb").dropDatabase();
var objid = new ObjectId();
db.getSiblingDB("otherdb").getCollection("othercoll").insert({_id:objid, field:"value"});
-var subdoc = db.getSiblingDB("otherdb").getCollection("othercoll").findOne({_id:objid})
+var subdoc = db.getSiblingDB("otherdb").getCollection("othercoll").findOne({_id:objid});
db.mycoll.drop();
db.mycoll.insert({_id:"asdf", asdf:new DBRef("othercoll", objid, "otherdb")});
diff --git a/jstests/core/regex2.js b/jstests/core/regex2.js
index 87d5cb47c05..51e24ae420a 100644
--- a/jstests/core/regex2.js
+++ b/jstests/core/regex2.js
@@ -62,8 +62,8 @@ assert.eq( 2 , t.find( { a : {$regex: a , $options: "i" } } ).count() , "obj C F
// Test s (DOT_ALL) option. Not supported with /regex/opts syntax
t.drop();
-t.save({a:'1 2'})
-t.save({a:'1\n2'})
+t.save({a:'1 2'});
+t.save({a:'1\n2'});
assert.eq( 1 , t.find( { a : {$regex: '1.*2'} } ).count() );
assert.eq( 2 , t.find( { a : {$regex: '1.*2', $options: 's'} } ).count() );
diff --git a/jstests/core/regex5.js b/jstests/core/regex5.js
index fab3eb9973c..5e3b7d0a6d3 100644
--- a/jstests/core/regex5.js
+++ b/jstests/core/regex5.js
@@ -1,6 +1,6 @@
-t = db.regex5
-t.drop()
+t = db.regex5;
+t.drop();
// Add filler data to make sure that indexed solutions are
// chosen over collection scans.
@@ -8,11 +8,11 @@ for (var i = 0; i < 10; i++) {
t.save({filler: "filler"});
}
-t.save( { x : [ "abc" , "xyz1" ] } )
-t.save( { x : [ "ac" , "xyz2" ] } )
+t.save( { x : [ "abc" , "xyz1" ] } );
+t.save( { x : [ "ac" , "xyz2" ] } );
-a = /.*b.*c/
-x = /.*y.*/
+a = /.*b.*c/;
+x = /.*y.*/;
doit = function() {
@@ -28,8 +28,8 @@ doit = function() {
assert.eq( 11 , t.find( { x : { $nin: [ a, "xyz1" ] } } ).count() , "J" ); // SERVER-322
assert.eq( 10 , t.find( { x : { $nin: [ a, "xyz2" ] } } ).count() , "K" ); // SERVER-322
assert.eq( 2 , t.find( { x : { $not: { $nin: [ x ] } } } ).count() , "L" ); // SERVER-322
- assert.eq( 11 , t.find( { x : { $nin: [ /^a.c/ ] } } ).count() , "M" ) // SERVER-322
-}
+ assert.eq( 11 , t.find( { x : { $nin: [ /^a.c/ ] } } ).count() , "M" ); // SERVER-322
+};
doit();
t.ensureIndex( {x:1} );
diff --git a/jstests/core/regex7.js b/jstests/core/regex7.js
index ab4f6089f9b..8f32ed603ad 100644
--- a/jstests/core/regex7.js
+++ b/jstests/core/regex7.js
@@ -6,21 +6,21 @@ t.insert({r:/^a/i});
t.insert({r:/^b/});
// no index
-assert.eq( /^a/, t.findOne({r:/^a/}).r, '1 1 a')
-assert.eq( 1, t.count({r:/^a/}), '1 2')
-assert.eq( /^a/i, t.findOne({r:/^a/i}).r, '2 1 a')
-assert.eq( 1, t.count({r:/^a/i}), '2 2 a')
-assert.eq( /^b/, t.findOne({r:/^b/}).r, '3 1 a')
-assert.eq( 1, t.count({r:/^b/}), '3 2 a')
+assert.eq( /^a/, t.findOne({r:/^a/}).r, '1 1 a');
+assert.eq( 1, t.count({r:/^a/}), '1 2');
+assert.eq( /^a/i, t.findOne({r:/^a/i}).r, '2 1 a');
+assert.eq( 1, t.count({r:/^a/i}), '2 2 a');
+assert.eq( /^b/, t.findOne({r:/^b/}).r, '3 1 a');
+assert.eq( 1, t.count({r:/^b/}), '3 2 a');
// with index
-t.ensureIndex({r:1})
-assert.eq( /^a/, t.findOne({r:/^a/}).r, '1 1 b')
-assert.eq( 1, t.count({r:/^a/}), '1 2 b')
-assert.eq( /^a/i, t.findOne({r:/^a/i}).r, '2 1 b')
-assert.eq( 1, t.count({r:/^a/i}), '2 2 b')
-assert.eq( /^b/, t.findOne({r:/^b/}).r, '3 1 b')
-assert.eq( 1, t.count({r:/^b/}), '3 2 b')
+t.ensureIndex({r:1});
+assert.eq( /^a/, t.findOne({r:/^a/}).r, '1 1 b');
+assert.eq( 1, t.count({r:/^a/}), '1 2 b');
+assert.eq( /^a/i, t.findOne({r:/^a/i}).r, '2 1 b');
+assert.eq( 1, t.count({r:/^a/i}), '2 2 b');
+assert.eq( /^b/, t.findOne({r:/^b/}).r, '3 1 b');
+assert.eq( 1, t.count({r:/^b/}), '3 2 b');
t.insert( {r:"a"} );
assert.eq( 2, t.count({r:/^a/}), 'c' ); \ No newline at end of file
diff --git a/jstests/core/regex8.js b/jstests/core/regex8.js
index 33dd74fb812..3bb598831a7 100644
--- a/jstests/core/regex8.js
+++ b/jstests/core/regex8.js
@@ -1,19 +1,19 @@
t = db.regex8;
-t.drop()
+t.drop();
-t.insert( { _id : 1 , a : "abc" } )
-t.insert( { _ud : 2 , a : "abc" } )
-t.insert( { _id : 3 , a : "bdc" } )
+t.insert( { _id : 1 , a : "abc" } );
+t.insert( { _ud : 2 , a : "abc" } );
+t.insert( { _id : 3 , a : "bdc" } );
function test( msg ){
- assert.eq( 3 , t.find().itcount() , msg + "1" )
- assert.eq( 2 , t.find( { a : /a.*/ } ).itcount() , msg + "2" )
- assert.eq( 3 , t.find( { a : /[ab].*/ } ).itcount() , msg + "3" )
- assert.eq( 3 , t.find( { a : /[a|b].*/ } ).itcount() , msg + "4" )
+ assert.eq( 3 , t.find().itcount() , msg + "1" );
+ assert.eq( 2 , t.find( { a : /a.*/ } ).itcount() , msg + "2" );
+ assert.eq( 3 , t.find( { a : /[ab].*/ } ).itcount() , msg + "3" );
+ assert.eq( 3 , t.find( { a : /[a|b].*/ } ).itcount() , msg + "4" );
}
test( "A" );
-t.ensureIndex( { a : 1 } )
-test( "B" )
+t.ensureIndex( { a : 1 } );
+test( "B" );
diff --git a/jstests/core/regex9.js b/jstests/core/regex9.js
index 896855c6dfb..e12310ee848 100644
--- a/jstests/core/regex9.js
+++ b/jstests/core/regex9.js
@@ -2,10 +2,10 @@
t = db.regex9;
t.drop();
-t.insert( { _id : 1 , a : [ "a" , "b" , "c" ] } )
-t.insert( { _id : 2 , a : [ "a" , "b" , "c" , "d" ] } )
-t.insert( { _id : 3 , a : [ "b" , "c" , "d" ] } )
+t.insert( { _id : 1 , a : [ "a" , "b" , "c" ] } );
+t.insert( { _id : 2 , a : [ "a" , "b" , "c" , "d" ] } );
+t.insert( { _id : 3 , a : [ "b" , "c" , "d" ] } );
-assert.eq( 2 , t.find( { a : /a/ } ).itcount() , "A1" )
-assert.eq( 2 , t.find( { a : { $regex : "a" } } ).itcount() , "A2" )
-assert.eq( 2 , t.find( { a : { $regex : /a/ } } ).itcount() , "A3" )
+assert.eq( 2 , t.find( { a : /a/ } ).itcount() , "A1" );
+assert.eq( 2 , t.find( { a : { $regex : "a" } } ).itcount() , "A2" );
+assert.eq( 2 , t.find( { a : { $regex : /a/ } } ).itcount() , "A3" );
diff --git a/jstests/core/regex_embed1.js b/jstests/core/regex_embed1.js
index 61b1b9a14f6..7e08ca66e77 100644
--- a/jstests/core/regex_embed1.js
+++ b/jstests/core/regex_embed1.js
@@ -1,11 +1,11 @@
-t = db.regex_embed1
+t = db.regex_embed1;
-t.drop()
+t.drop();
-t.insert( { _id : 1 , a : [ { x : "abc" } , { x : "def" } ] } )
-t.insert( { _id : 2 , a : [ { x : "ab" } , { x : "de" } ] } )
-t.insert( { _id : 3 , a : [ { x : "ab" } , { x : "de" } , { x : "abc" } ] } )
+t.insert( { _id : 1 , a : [ { x : "abc" } , { x : "def" } ] } );
+t.insert( { _id : 2 , a : [ { x : "ab" } , { x : "de" } ] } );
+t.insert( { _id : 3 , a : [ { x : "ab" } , { x : "de" } , { x : "abc" } ] } );
function test( m ){
assert.eq( 3 , t.find().itcount() , m + "1" );
@@ -18,7 +18,7 @@ function test( m ){
test( "A" );
-t.ensureIndex( { "a.x" : 1 } )
+t.ensureIndex( { "a.x" : 1 } );
test( "B" );
diff --git a/jstests/core/regex_not_id.js b/jstests/core/regex_not_id.js
index 6eb5a4e7bfd..b5d0f1b01a6 100644
--- a/jstests/core/regex_not_id.js
+++ b/jstests/core/regex_not_id.js
@@ -1,7 +1,7 @@
// don't allow regex as _id: SERVER-9502
var testColl = db.regex_not_id;
-testColl.drop()
+testColl.drop();
assert.writeOK(testColl.insert({ _id: "ABCDEF1" }, {writeConcern:{w:1}}));
diff --git a/jstests/core/remove.js b/jstests/core/remove.js
index 6800a41fedc..9a71767c3c7 100644
--- a/jstests/core/remove.js
+++ b/jstests/core/remove.js
@@ -24,4 +24,4 @@ f(500, -1);
assert(t.validate().valid , "C" );
// no query for remove() throws starting in 2.6
-assert.throws(function() { db.t.remove() });
+assert.throws(function() { db.t.remove(); });
diff --git a/jstests/core/remove6.js b/jstests/core/remove6.js
index bee0537957d..83f5a5e6733 100644
--- a/jstests/core/remove6.js
+++ b/jstests/core/remove6.js
@@ -32,7 +32,7 @@ test( "a" );
test( "b" , { x : 1 } );
test( "c" , { tags : 1 } );
-N = 5000
+N = 5000;
test( "a2" );
test( "b2" , { x : 1 } );
diff --git a/jstests/core/remove7.js b/jstests/core/remove7.js
index 35662467c04..f50419b3bd0 100644
--- a/jstests/core/remove7.js
+++ b/jstests/core/remove7.js
@@ -1,5 +1,5 @@
-t = db.remove7
+t = db.remove7;
t.drop();
diff --git a/jstests/core/remove8.js b/jstests/core/remove8.js
index 3ab53f3289a..32d8270e9c0 100644
--- a/jstests/core/remove8.js
+++ b/jstests/core/remove8.js
@@ -12,10 +12,10 @@ function fill(){
fill();
assert.eq( N , t.count() , "A" );
-t.remove( {} )
+t.remove( {} );
assert.eq( 0 , t.count() , "B" );
fill();
assert.eq( N , t.count() , "C" );
-db.eval( function(){ db.remove8.remove( {} ); } )
+db.eval( function(){ db.remove8.remove( {} ); } );
assert.eq( 0 , t.count() , "D" );
diff --git a/jstests/core/remove_justone.js b/jstests/core/remove_justone.js
index e412a13483c..19bfd6d1a03 100644
--- a/jstests/core/remove_justone.js
+++ b/jstests/core/remove_justone.js
@@ -1,16 +1,16 @@
-t = db.remove_justone
-t.drop()
+t = db.remove_justone;
+t.drop();
-t.insert( { x : 1 } )
-t.insert( { x : 1 } )
-t.insert( { x : 1 } )
-t.insert( { x : 1 } )
+t.insert( { x : 1 } );
+t.insert( { x : 1 } );
+t.insert( { x : 1 } );
+t.insert( { x : 1 } );
-assert.eq( 4 , t.count() )
+assert.eq( 4 , t.count() );
-t.remove( { x : 1 } , true )
-assert.eq( 3 , t.count() )
+t.remove( { x : 1 } , true );
+assert.eq( 3 , t.count() );
-t.remove( { x : 1 } )
-assert.eq( 0 , t.count() )
+t.remove( { x : 1 } );
+assert.eq( 0 , t.count() );
diff --git a/jstests/core/remove_undefined.js b/jstests/core/remove_undefined.js
index d5344a3a562..51df72c6bbf 100644
--- a/jstests/core/remove_undefined.js
+++ b/jstests/core/remove_undefined.js
@@ -1,28 +1,28 @@
-t = db.drop_undefined.js
+t = db.drop_undefined.js;
-t.insert( { _id : 1 } )
-t.insert( { _id : 2 } )
-t.insert( { _id : null } )
+t.insert( { _id : 1 } );
+t.insert( { _id : 2 } );
+t.insert( { _id : null } );
-z = { foo : 1 , x : null }
+z = { foo : 1 , x : null };
-t.remove( { x : z.bar } )
-assert.eq( 3 , t.count() , "A1" )
+t.remove( { x : z.bar } );
+assert.eq( 3 , t.count() , "A1" );
-t.remove( { x : undefined } )
-assert.eq( 3 , t.count() , "A2" )
+t.remove( { x : undefined } );
+assert.eq( 3 , t.count() , "A2" );
-assert.throws( function(){ t.remove( { _id : z.bar } ) } , null , "B1" )
-assert.throws( function(){ t.remove( { _id : undefined } ) } , null , "B2" )
+assert.throws( function(){ t.remove( { _id : z.bar } ); } , null , "B1" );
+assert.throws( function(){ t.remove( { _id : undefined } ); } , null , "B2" );
-t.remove( { _id : z.x } )
-assert.eq( 2 , t.count() , "C1" )
+t.remove( { _id : z.x } );
+assert.eq( 2 , t.count() , "C1" );
-t.insert( { _id : null } )
-assert.eq( 3 , t.count() , "C2" )
+t.insert( { _id : null } );
+assert.eq( 3 , t.count() , "C2" );
-assert.throws( function(){ t.remove( { _id : undefined } ) } , null, "C3" )
-assert.eq( 3 , t.count() , "C4" )
+assert.throws( function(){ t.remove( { _id : undefined } ); } , null, "C3" );
+assert.eq( 3 , t.count() , "C4" );
diff --git a/jstests/core/rename2.js b/jstests/core/rename2.js
index a06268f1bfb..c913bcbe66e 100644
--- a/jstests/core/rename2.js
+++ b/jstests/core/rename2.js
@@ -6,14 +6,14 @@ b = db.rename2b;
a.drop();
b.drop();
-a.save( { x : 1 } )
-a.save( { x : 2 } )
-a.save( { x : 3 } )
+a.save( { x : 1 } );
+a.save( { x : 2 } );
+a.save( { x : 3 } );
-assert.eq( 3 , a.count() , "A" )
-assert.eq( 0 , b.count() , "B" )
+assert.eq( 3 , a.count() , "A" );
+assert.eq( 0 , b.count() , "B" );
assert( a.renameCollection( "rename2b" ) , "the command" );
-assert.eq( 0 , a.count() , "C" )
-assert.eq( 3 , b.count() , "D" )
+assert.eq( 0 , a.count() , "C" );
+assert.eq( 3 , b.count() , "D" );
diff --git a/jstests/core/rename3.js b/jstests/core/rename3.js
index 5e1005f8176..31a91772a75 100644
--- a/jstests/core/rename3.js
+++ b/jstests/core/rename3.js
@@ -1,10 +1,10 @@
-a = db.rename3a
-b = db.rename3b
+a = db.rename3a;
+b = db.rename3b;
a.drop();
-b.drop()
+b.drop();
a.save( { x : 1 } );
b.save( { x : 2 } );
@@ -18,7 +18,7 @@ assert.eq( 0 , res.ok , "should fail: " + tojson( res ) );
assert.eq( 1 , a.findOne().x , "before 1b" );
assert.eq( 2 , b.findOne().x , "before 2b" );
-res = b.renameCollection( a._shortName , true )
+res = b.renameCollection( a._shortName , true );
assert.eq( 1 , res.ok , "should succeed:" + tojson( res ) );
assert.eq( 2 , a.findOne().x , "after 1" );
diff --git a/jstests/core/rename4.js b/jstests/core/rename4.js
index 85cd5e882b5..92a26ef6ac0 100644
--- a/jstests/core/rename4.js
+++ b/jstests/core/rename4.js
@@ -8,9 +8,9 @@ function bad( f ) {
//Ensure error
if (!res.hasWriteError()) {
print("Error:" + res.toString());
- print("Existing docs (before)")
+ print("Existing docs (before)");
printjson(docsBeforeUpdate);
- print("Existing docs (after)")
+ print("Existing docs (after)");
printjson(t.find().toArray());
assert( false, "Expected error but didn't get one for: " + f );
}
diff --git a/jstests/core/rename6.js b/jstests/core/rename6.js
index 061f105523f..5e77b4c45a6 100644
--- a/jstests/core/rename6.js
+++ b/jstests/core/rename6.js
@@ -3,10 +3,10 @@
// that is greater than 120 chars. To do this we create a long index name and try
// and rename the collection to one with a much longer name. We use the test database
// by default and we add this here to ensure we are using it
-testDB = db.getSiblingDB("test")
+testDB = db.getSiblingDB("test");
c = "rename2c";
dbc = testDB.getCollection(c);
-d = "dest4567890123456789012345678901234567890123456789012345678901234567890"
+d = "dest4567890123456789012345678901234567890123456789012345678901234567890";
dbd = testDB.getCollection(d);
dbc.ensureIndex({ "name" : 1,
"date" : 1,
diff --git a/jstests/core/rename7.js b/jstests/core/rename7.js
index e8b30c6c64f..4b9258fd671 100644
--- a/jstests/core/rename7.js
+++ b/jstests/core/rename7.js
@@ -54,7 +54,7 @@ a.save( {a: 1} );
a.save( {a: 2} );
a.save( {a: 3} );
-previousMaxSize = a.stats().maxSize
+previousMaxSize = a.stats().maxSize;
assert.commandWorked( admin.runCommand( {renameCollection: "db_a.rename7_capped",
to: "db_b.rename7_capped"} ) );
diff --git a/jstests/core/rename_stayTemp.js b/jstests/core/rename_stayTemp.js
index 47230023244..ccada6abf39 100644
--- a/jstests/core/rename_stayTemp.js
+++ b/jstests/core/rename_stayTemp.js
@@ -1,10 +1,10 @@
-orig = 'rename_stayTemp_orig'
-dest = 'rename_stayTemp_dest'
+orig = 'rename_stayTemp_orig';
+dest = 'rename_stayTemp_dest';
-db[orig].drop()
-db[dest].drop()
+db[orig].drop();
+db[dest].drop();
-function ns(coll){ return db[coll].getFullName() }
+function ns(coll){ return db[coll].getFullName(); }
function istemp( name ) {
var result = db.runCommand( "listCollections", { filter : { name : name } } );
@@ -14,7 +14,7 @@ function istemp( name ) {
return collections[0].options.temp ? true : false;
}
-db.runCommand({create: orig, temp:1})
+db.runCommand({create: orig, temp:1});
assert(istemp(orig));
db.adminCommand({renameCollection: ns(orig), to: ns(dest)});
@@ -22,7 +22,7 @@ assert(!istemp(dest));
db[dest].drop();
-db.runCommand({create: orig, temp:1})
+db.runCommand({create: orig, temp:1});
assert( istemp(orig) );
db.adminCommand({renameCollection: ns(orig), to: ns(dest), stayTemp: true});
diff --git a/jstests/core/repair_database.js b/jstests/core/repair_database.js
index ca4bddd4bb1..c7ac82320c7 100644
--- a/jstests/core/repair_database.js
+++ b/jstests/core/repair_database.js
@@ -8,22 +8,22 @@
// 1. Drop db
var mydb = db.getSisterDB( "repairDB" );
-mydb.dropDatabase()
+mydb.dropDatabase();
var myColl = mydb.a;
// 2
var doc = {_id:1, a:"hello world"};
myColl.insert(doc);
-myColl.ensureIndex({a:1})
+myColl.ensureIndex({a:1});
mydb.repairDatabase();
var foundDoc = myColl.findOne();
-assert.neq(null, foundDoc)
-assert.eq(1, foundDoc._id)
+assert.neq(null, foundDoc);
+assert.eq(1, foundDoc._id);
-assert.docEq(doc, myColl.findOne({a:doc.a}))
-assert.docEq(doc, myColl.findOne({_id:1}))
+assert.docEq(doc, myColl.findOne({a:doc.a}));
+assert.docEq(doc, myColl.findOne({_id:1}));
// 3
var myColl2 = mydb.b;
@@ -35,5 +35,5 @@ var myColl2 = mydb.b;
myColl.insert(doc);
myColl2.insert(doc);
mydb.repairDatabase();
-assert.docEq(doc, myColl.findOne({a:doc.a}))
-assert.docEq(doc, myColl2.findOne({a:doc.a}))
+assert.docEq(doc, myColl.findOne({a:doc.a}));
+assert.docEq(doc, myColl2.findOne({a:doc.a}));
diff --git a/jstests/core/repair_server12955.js b/jstests/core/repair_server12955.js
index 9582e4c7852..65c9b5f241a 100644
--- a/jstests/core/repair_server12955.js
+++ b/jstests/core/repair_server12955.js
@@ -1,9 +1,9 @@
mydb = db.getSisterDB( "repair_server12955" );
-mydb.dropDatabase()
+mydb.dropDatabase();
-mydb.foo.ensureIndex({a:"text"})
-mydb.foo.insert({a:"hello world"})
+mydb.foo.ensureIndex({a:"text"});
+mydb.foo.insert({a:"hello world"});
before = mydb.stats().dataFileVersion;
diff --git a/jstests/core/run_program1.js b/jstests/core/run_program1.js
index 7a994b2171a..871b53c8ddd 100644
--- a/jstests/core/run_program1.js
+++ b/jstests/core/run_program1.js
@@ -1,8 +1,8 @@
if ( ! _isWindows() ) {
// note that normal program exit returns 0
- assert.eq (0, runProgram('true'))
- assert.neq(0, runProgram('false'))
+ assert.eq (0, runProgram('true'));
+ assert.neq(0, runProgram('false'));
assert.neq(0, runProgram('this_program_doesnt_exit'));
//verify output visually
diff --git a/jstests/core/server1470.js b/jstests/core/server1470.js
index 0bb4d02c933..3ab39bb3c38 100644
--- a/jstests/core/server1470.js
+++ b/jstests/core/server1470.js
@@ -4,10 +4,10 @@ t.drop();
q = { "name" : "first" , "pic" : { "$ref" : "foo", "$id" : ObjectId("4c48d04cd33a5a92628c9af6") } };
t.update( q , {$set:{ x : 1 } } , true, true );
-ref = t.findOne().pic
+ref = t.findOne().pic;
assert.eq( "object", typeof( ref ) );
-assert.eq( q.pic["$ref"] , ref["$ref"] )
-assert.eq( q.pic["$id"] , ref["$id"] )
+assert.eq( q.pic["$ref"] , ref["$ref"] );
+assert.eq( q.pic["$id"] , ref["$id"] );
// just make we haven't broken other update operators
t.drop();
diff --git a/jstests/core/server14747.js b/jstests/core/server14747.js
index dc937ff4889..e75407a7fdf 100644
--- a/jstests/core/server14747.js
+++ b/jstests/core/server14747.js
@@ -4,7 +4,7 @@
(function() {
"use strict";
- var t = db.jstests_server14747
+ var t = db.jstests_server14747;
t.drop();
t.ensureIndex({a: 1, b: 1});
diff --git a/jstests/core/server14753.js b/jstests/core/server14753.js
index 7d6667450f8..81d865996db 100644
--- a/jstests/core/server14753.js
+++ b/jstests/core/server14753.js
@@ -4,7 +4,7 @@
(function() {
"use strict";
- var t = db.jstests_server14753
+ var t = db.jstests_server14753;
t.drop();
t.ensureIndex({a: 1});
diff --git a/jstests/core/server5346.js b/jstests/core/server5346.js
index f4a692bd16a..f627d0e68bd 100644
--- a/jstests/core/server5346.js
+++ b/jstests/core/server5346.js
@@ -2,14 +2,14 @@
t = db.server5346;
t.drop();
-x = { _id : 1 , versions : {} }
-t.insert( x )
+x = { _id : 1 , versions : {} };
+t.insert( x );
-t.update({ _id : 1 }, { $inc : { "versions.2_01" : 1 } } )
-t.update({ _id : 1 }, { $inc : { "versions.2_1" : 2 } } )
-t.update({ _id : 1 }, { $inc : { "versions.01" : 3 } } )
-t.update({ _id : 1 }, { $inc : { "versions.1" : 4 } } )
+t.update({ _id : 1 }, { $inc : { "versions.2_01" : 1 } } );
+t.update({ _id : 1 }, { $inc : { "versions.2_1" : 2 } } );
+t.update({ _id : 1 }, { $inc : { "versions.01" : 3 } } );
+t.update({ _id : 1 }, { $inc : { "versions.1" : 4 } } );
// Make sure the correct fields are set, without duplicates.
assert.docEq( { "_id" : 1, "versions" : { "01" : 3, "1" : 4, "2_01" : 1, "2_1" : 2 } },
- t.findOne())
+ t.findOne());
diff --git a/jstests/core/set3.js b/jstests/core/set3.js
index 611abc4e6bf..f654ab64889 100644
--- a/jstests/core/set3.js
+++ b/jstests/core/set3.js
@@ -3,7 +3,7 @@ t = db.set3;
t.drop();
t.insert( { "test1" : { "test2" : { "abcdefghijklmnopqrstu" : {"id":1} } } } );
-t.update( {}, {"$set":{"test1.test2.abcdefghijklmnopqrstuvwxyz":{"id":2}}})
+t.update( {}, {"$set":{"test1.test2.abcdefghijklmnopqrstuvwxyz":{"id":2}}});
x = t.findOne();
assert.eq( 1 , x.test1.test2.abcdefghijklmnopqrstu.id , "A" );
diff --git a/jstests/core/set4.js b/jstests/core/set4.js
index b37366cdb81..d26a241f322 100644
--- a/jstests/core/set4.js
+++ b/jstests/core/set4.js
@@ -2,11 +2,11 @@
t = db.set4;
t.drop();
-orig = { _id:1 , a : [ { x : 1 } ]}
+orig = { _id:1 , a : [ { x : 1 } ]};
t.insert( orig );
t.update( {}, { $set : { 'a.0.x' : 2, 'foo.bar' : 3 } } );
-orig.a[0].x = 2; orig.foo = { bar : 3 }
+orig.a[0].x = 2; orig.foo = { bar : 3 };
assert.eq( orig , t.findOne() , "A" );
t.update( {}, { $set : { 'a.0.x' : 4, 'foo.bar' : 5 } } );
diff --git a/jstests/core/set5.js b/jstests/core/set5.js
index afa0d014bde..e24c4fdf6a7 100644
--- a/jstests/core/set5.js
+++ b/jstests/core/set5.js
@@ -9,9 +9,9 @@ function check( want , err ){
}
t.update( { a : 5 } , { $set : { a : 6 , b : null } } , true );
-check( { a : 6 , b : null } , "A" )
+check( { a : 6 , b : null } , "A" );
t.drop();
t.update( { z : 5 } , { $set : { z : 6 , b : null } } , true );
-check( { b : null , z : 6 } , "B" )
+check( { b : null , z : 6 } , "B" );
diff --git a/jstests/core/set6.js b/jstests/core/set6.js
index d41e7aba971..87a8100d232 100644
--- a/jstests/core/set6.js
+++ b/jstests/core/set6.js
@@ -2,19 +2,19 @@
t = db.set6;
t.drop();
-x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) }
-t.insert( x )
+x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) };
+t.insert( x );
assert.eq( x , t.findOne() , "A" );
-x.r.$id = new ObjectId()
+x.r.$id = new ObjectId();
t.update({}, { $set : { r : x.r } } );
assert.eq( x , t.findOne() , "B");
-x.r2 = new DBRef( "foo2" , 5 )
+x.r2 = new DBRef( "foo2" , 5 );
t.update( {} , { $set : { "r2" : x.r2 } } );
-assert.eq( x , t.findOne() , "C" )
+assert.eq( x , t.findOne() , "C" );
x.r.$id = 2;
-t.update( {} , { $set : { "r.$id" : 2 } } )
+t.update( {} , { $set : { "r.$id" : 2 } } );
assert.eq( x.r.$id , t.findOne().r.$id , "D");
diff --git a/jstests/core/set_param1.js b/jstests/core/set_param1.js
index b7ceefcc77c..3b31d2d8caa 100644
--- a/jstests/core/set_param1.js
+++ b/jstests/core/set_param1.js
@@ -1,14 +1,14 @@
// Tests for accessing logLevel server parameter using getParameter/setParameter commands
// and shell helpers.
-old = db.adminCommand( { "getParameter" : "*" } )
-tmp1 = db.adminCommand( { "setParameter" : 1 , "logLevel" : 5 } )
-tmp2 = db.adminCommand( { "setParameter" : 1 , "logLevel" : old.logLevel } )
-now = db.adminCommand( { "getParameter" : "*" } )
-
-assert.eq( old , now , "A" )
-assert.eq( old.logLevel , tmp1.was , "B" )
-assert.eq( 5 , tmp2.was , "C" )
+old = db.adminCommand( { "getParameter" : "*" } );
+tmp1 = db.adminCommand( { "setParameter" : 1 , "logLevel" : 5 } );
+tmp2 = db.adminCommand( { "setParameter" : 1 , "logLevel" : old.logLevel } );
+now = db.adminCommand( { "getParameter" : "*" } );
+
+assert.eq( old , now , "A" );
+assert.eq( old.logLevel , tmp1.was , "B" );
+assert.eq( 5 , tmp2.was , "C" );
//
// component verbosity
diff --git a/jstests/core/shell1.js b/jstests/core/shell1.js
index 2e6c7292374..6d200e7a5b1 100644
--- a/jstests/core/shell1.js
+++ b/jstests/core/shell1.js
@@ -1,8 +1,8 @@
x = 1;
-shellHelper( "show", "tables;" )
-shellHelper( "show", "tables" )
-shellHelper( "show", "tables ;" )
+shellHelper( "show", "tables;" );
+shellHelper( "show", "tables" );
+shellHelper( "show", "tables ;" );
// test slaveOk levels
assert(!db.getSlaveOk() && !db.test.getSlaveOk() && !db.getMongo().getSlaveOk(), "slaveOk 1");
diff --git a/jstests/core/shell_writeconcern.js b/jstests/core/shell_writeconcern.js
index 4a4fa4f0ae5..272a84c0a2c 100644
--- a/jstests/core/shell_writeconcern.js
+++ b/jstests/core/shell_writeconcern.js
@@ -1,27 +1,27 @@
-"use strict"
+"use strict";
// check that shell writeconcern work correctly
// 1.) tests that it can be set on each level and is inherited
// 2.) tests that each operation (update/insert/remove/save) take and ensure a write concern
var collA = db.shell_wc_a;
var collB = db.shell_wc_b;
-collA.drop()
-collB.drop()
+collA.drop();
+collB.drop();
// test inheritance
-db.setWriteConcern({w:1})
-assert.eq(1, db.getWriteConcern().toJSON().w)
-assert.eq(1, collB.getWriteConcern().toJSON().w)
+db.setWriteConcern({w:1});
+assert.eq(1, db.getWriteConcern().toJSON().w);
+assert.eq(1, collB.getWriteConcern().toJSON().w);
-collA.setWriteConcern({w:2})
-assert.eq(2, collA.getWriteConcern().toJSON().w)
-collA.unsetWriteConcern()
-assert.eq(1, collA.getWriteConcern().toJSON().w)
+collA.setWriteConcern({w:2});
+assert.eq(2, collA.getWriteConcern().toJSON().w);
+collA.unsetWriteConcern();
+assert.eq(1, collA.getWriteConcern().toJSON().w);
-db.unsetWriteConcern()
-assert.eq(undefined, collA.getWriteConcern())
-assert.eq(undefined, collB.getWriteConcern())
-assert.eq(undefined, db.getWriteConcern())
+db.unsetWriteConcern();
+assert.eq(undefined, collA.getWriteConcern());
+assert.eq(undefined, collB.getWriteConcern());
+assert.eq(undefined, db.getWriteConcern());
// test methods, by generating an error
var res = assert.writeOK(collA.save({_id:1}, {writeConcern:{w:1}}));
@@ -74,5 +74,5 @@ assert.eq(1, res.getWriteErrors().length, tojson(res));
assert.eq(undefined, res.writeConcernErrors, tojson(res));
var res = assert.writeError(collA.insert([{_id:1}, {_id:1}], {ordered:false, writeConcern:{w:1}}));
-assert.eq(2, res.getWriteErrors().length, tojson(res))
-assert.eq(undefined, res.writeConcernErrors, tojson(res))
+assert.eq(2, res.getWriteErrors().length, tojson(res));
+assert.eq(undefined, res.writeConcernErrors, tojson(res));
diff --git a/jstests/core/shelltypes.js b/jstests/core/shelltypes.js
index d3eae35e468..e39c63272aa 100644
--- a/jstests/core/shelltypes.js
+++ b/jstests/core/shelltypes.js
@@ -88,9 +88,9 @@ assert.throws(function() { ObjectId.fromDate(dateA.toISOString()); }, null,
// SERVER-14623 dates less than or equal to 1978-07-04T21:24:15Z fail
var checkFromDate = function(millis, expected, comment) {
- var oid = ObjectId.fromDate(new Date(millis))
+ var oid = ObjectId.fromDate(new Date(millis));
assert.eq(oid.valueOf(), expected, comment);
-}
+};
checkFromDate(Math.pow(2,28) * 1000, "100000000000000000000000", "1978-07-04T21:24:16Z");
checkFromDate((Math.pow(2,28) * 1000) - 1 , "0fffffff0000000000000000", "1978-07-04T21:24:15Z");
checkFromDate(0, "000000000000000000000000", "start of epoch");
diff --git a/jstests/core/slice1.js b/jstests/core/slice1.js
index b20e7e48b14..6037fe0eb1a 100644
--- a/jstests/core/slice1.js
+++ b/jstests/core/slice1.js
@@ -41,8 +41,8 @@ assert.eq(out.a , [0,1,2]);
assert.eq(out.b , undefined);
assert.eq(out.c , 1);
-t.drop()
-t.insert({comments: [{id:0, text:'a'},{id:1, text:'b'},{id:2, text:'c'},{id:3, text:'d'}], title:'foo'})
+t.drop();
+t.insert({comments: [{id:0, text:'a'},{id:1, text:'b'},{id:2, text:'c'},{id:3, text:'d'}], title:'foo'});
out = t.findOne({}, {comments:{$slice:2}, 'comments.id':true});
diff --git a/jstests/core/snapshot_queries.js b/jstests/core/snapshot_queries.js
index 75332b1cc95..684a4b9459e 100644
--- a/jstests/core/snapshot_queries.js
+++ b/jstests/core/snapshot_queries.js
@@ -20,7 +20,7 @@
assert.eq(1, cursor.next()["_id"]);
// Force a document move (on MMAP) while the query is yielded for a getMore.
- var bigString = Array(1024*1024).toString()
+ var bigString = Array(1024*1024).toString();
assert.writeOK(coll.update({_id: 1}, {$set: {padding: bigString}}));
assert.eq(2, cursor.next()["_id"]);
diff --git a/jstests/core/sort1.js b/jstests/core/sort1.js
index 12b97728e90..ce530872e8c 100644
--- a/jstests/core/sort1.js
+++ b/jstests/core/sort1.js
@@ -1,6 +1,6 @@
debug = function( s ){
//print( s );
-}
+};
t = db.sort1;
t.drop();
@@ -11,7 +11,7 @@ t.save({x:2,z:33});
t.save({x:3,z:33});
t.save({x:1,z:33});
-debug( "a" )
+debug( "a" );
for( var pass = 0; pass < 2; pass++ ) {
assert( t.find().sort({x:1})[0].x == 1 );
assert( t.find().sort({x:1}).skip(1)[0].x == 2 );
@@ -23,7 +23,7 @@ for( var pass = 0; pass < 2; pass++ ) {
}
-debug( "b" )
+debug( "b" );
assert(t.validate().valid);
t.drop();
@@ -32,7 +32,7 @@ t.save({x:'aba'});
t.save({x:'zed'});
t.save({x:'foo'});
-debug( "c" )
+debug( "c" );
for( var pass = 0; pass < 2; pass++ ) {
debug( tojson( t.find().sort( { "x" : 1 } ).limit(1).next() ) );
@@ -43,6 +43,6 @@ for( var pass = 0; pass < 2; pass++ ) {
t.ensureIndex({x:1});
}
-debug( "d" )
+debug( "d" );
assert(t.validate().valid);
diff --git a/jstests/core/sort10.js b/jstests/core/sort10.js
index e9663f4a55d..657da665499 100644
--- a/jstests/core/sort10.js
+++ b/jstests/core/sort10.js
@@ -13,8 +13,8 @@ function checkSorting1(opts) {
}
}
-checkSorting1({})
-checkSorting1({"background":true})
+checkSorting1({});
+checkSorting1({"background":true});
@@ -34,15 +34,15 @@ dates = [new Date(-5000000000000), new Date(5000000000000), new Date(0), new Dat
for (var i = 0; i < dates.length; i++) {
t.insert({x:dates[i]});
}
-dates.sort(function(a,b){return a - b});
-reverseDates = dates.slice(0).reverse()
+dates.sort(function(a,b){return a - b;});
+reverseDates = dates.slice(0).reverse();
-checkSorting2(dates, 1)
-checkSorting2(reverseDates, -1)
-t.ensureIndex({x:1})
-checkSorting2(dates, 1)
-checkSorting2(reverseDates, -1)
-t.dropIndexes()
-t.ensureIndex({x:-1})
-checkSorting2(dates, 1)
-checkSorting2(reverseDates, -1)
+checkSorting2(dates, 1);
+checkSorting2(reverseDates, -1);
+t.ensureIndex({x:1});
+checkSorting2(dates, 1);
+checkSorting2(reverseDates, -1);
+t.dropIndexes();
+t.ensureIndex({x:-1});
+checkSorting2(dates, 1);
+checkSorting2(reverseDates, -1);
diff --git a/jstests/core/sort2.js b/jstests/core/sort2.js
index 6dfa8486201..2528751cfc1 100644
--- a/jstests/core/sort2.js
+++ b/jstests/core/sort2.js
@@ -17,8 +17,8 @@ for( var pass = 0; pass < 2; pass++ ) {
assert(t.validate().valid);
t.drop();
-t.insert({ x: 1 })
-t.insert({ x: 5000000000 })
+t.insert({ x: 1 });
+t.insert({ x: 5000000000 });
t.insert({ x: NaN });
t.insert({ x: Infinity });
t.insert({ x: -Infinity });
diff --git a/jstests/core/sort4.js b/jstests/core/sort4.js
index 5174b46f41f..9e4076b1c71 100644
--- a/jstests/core/sort4.js
+++ b/jstests/core/sort4.js
@@ -20,19 +20,19 @@ function nice( sort , correct , extra ){
return s;
}
-t.save({name: 'A', prename: 'B'})
-t.save({name: 'A', prename: 'C'})
-t.save({name: 'B', prename: 'B'})
-t.save({name: 'B', prename: 'D'})
+t.save({name: 'A', prename: 'B'});
+t.save({name: 'A', prename: 'C'});
+t.save({name: 'B', prename: 'B'});
+t.save({name: 'B', prename: 'D'});
nice( { name:1 } , "AB,AC,BB,BD" , "s1" );
nice( { prename : 1 } , "AB,BB,AC,BD" , "s2" );
nice( {name:1, prename:1} , "AB,AC,BB,BD" , "s3" );
-t.save({name: 'A'})
+t.save({name: 'A'});
nice( {name:1, prename:1} , "A,AB,AC,BB,BD" , "e1" );
-t.save({name: 'C'})
+t.save({name: 'C'});
nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2" ); // SERVER-282
t.ensureIndex( { name : 1 , prename : 1 } );
diff --git a/jstests/core/sort6.js b/jstests/core/sort6.js
index 027ba7a01f5..323fb92a335 100644
--- a/jstests/core/sort6.js
+++ b/jstests/core/sort6.js
@@ -8,31 +8,31 @@ function get( x ){
// part 1
t.drop();
-t.insert({_id:1,c:null})
-t.insert({_id:2,c:1})
-t.insert({_id:3,c:2})
+t.insert({_id:1,c:null});
+t.insert({_id:2,c:1});
+t.insert({_id:3,c:2});
-assert.eq( [3,2,1] , get( -1 ) , "A1" ) // SERVER-635
-assert.eq( [1,2,3] , get( 1 ) , "A2" )
+assert.eq( [3,2,1] , get( -1 ) , "A1" ); // SERVER-635
+assert.eq( [1,2,3] , get( 1 ) , "A2" );
t.ensureIndex( { c : 1 } );
-assert.eq( [3,2,1] , get( -1 ) , "B1" )
-assert.eq( [1,2,3] , get( 1 ) , "B2" )
+assert.eq( [3,2,1] , get( -1 ) , "B1" );
+assert.eq( [1,2,3] , get( 1 ) , "B2" );
// part 2
t.drop();
-t.insert({_id:1})
-t.insert({_id:2,c:1})
-t.insert({_id:3,c:2})
+t.insert({_id:1});
+t.insert({_id:2,c:1});
+t.insert({_id:3,c:2});
-assert.eq( [3,2,1] , get( -1 ) , "C1" ) // SERVER-635
-assert.eq( [1,2,3] , get( 1 ) , "C2" )
+assert.eq( [3,2,1] , get( -1 ) , "C1" ); // SERVER-635
+assert.eq( [1,2,3] , get( 1 ) , "C2" );
t.ensureIndex( { c : 1 } );
-assert.eq( [3,2,1] , get( -1 ) , "D1" )
-assert.eq( [1,2,3] , get( 1 ) , "X2" )
+assert.eq( [3,2,1] , get( -1 ) , "D1" );
+assert.eq( [1,2,3] , get( 1 ) , "X2" );
diff --git a/jstests/core/sortg.js b/jstests/core/sortg.js
index 0ca1d2e88cf..ec69d8fc772 100644
--- a/jstests/core/sortg.js
+++ b/jstests/core/sortg.js
@@ -3,7 +3,7 @@
t = db.jstests_sortg;
t.drop();
-big = new Array( 1000000 ).toString()
+big = new Array( 1000000 ).toString();
for( i = 0; i < 100; ++i ) {
t.save( {b:0} );
@@ -16,7 +16,7 @@ for( i = 0; i < 40; ++i ) {
function memoryException( sortSpec, querySpec ) {
querySpec = querySpec || {};
var ex = assert.throws( function() {
- t.find( querySpec ).sort( sortSpec ).batchSize( 1000 ).itcount()
+ t.find( querySpec ).sort( sortSpec ).batchSize( 1000 ).itcount();
} );
assert( ex.toString().match( /Sort/ ) );
}
diff --git a/jstests/core/splitvector.js b/jstests/core/splitvector.js
index 9665ded9f18..5306bd61ff4 100644
--- a/jstests/core/splitvector.js
+++ b/jstests/core/splitvector.js
@@ -30,7 +30,7 @@ assertChunkSizes = function ( splitVec , numDocs , maxChunkSize , msg ){
assert.gt( maxChunkSize , size , "A"+i , msg + "b" );
}
}
-}
+};
// Takes two documents and asserts that both contain exactly the same set of field names.
// This is useful for checking that splitPoints have the same format as the original key pattern,
@@ -47,11 +47,11 @@ var assertFieldNamesMatch = function( splitPoint , keyPattern ){
assert( splitPoint.hasOwnProperty( p ) , "property " + p + " not in splitPoint" );
}
}
-}
+};
var resetCollection = function() {
f.drop();
-}
+};
// -------------------------
// TESTS START HERE
@@ -109,7 +109,7 @@ var case4 = function() {
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
-}
+};
case4();
// -------------------------
@@ -131,7 +131,7 @@ var case5 = function() {
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
-}
+};
case5();
// -------------------------
@@ -153,7 +153,7 @@ var case6 = function() {
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
-}
+};
case6();
// -------------------------
@@ -180,7 +180,7 @@ var case7 = function() {
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
-}
+};
case7();
// -------------------------
@@ -213,7 +213,7 @@ var case8 = function() {
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
-}
+};
case8();
// -------------------------
@@ -229,7 +229,7 @@ var case9 = function() {
f.save( { x: 3 } );
assert.eq( 3 , f.count() );
- print( f.getFullName() )
+ print( f.getFullName() );
res = db.runCommand( { splitVector: f.getFullName() , keyPattern: {x:1} , force : true } );
@@ -247,7 +247,7 @@ var case9 = function() {
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
}
-}
+};
case9();
// -------------------------
diff --git a/jstests/core/stages_and_hash.js b/jstests/core/stages_and_hash.js
index 79235d0678c..3bf1bde4951 100644
--- a/jstests/core/stages_and_hash.js
+++ b/jstests/core/stages_and_hash.js
@@ -8,9 +8,9 @@ for (var i = 0; i < N; ++i) {
t.insert({foo: i, bar: N - i, baz: i});
}
-t.ensureIndex({foo: 1})
-t.ensureIndex({bar: 1})
-t.ensureIndex({baz: 1})
+t.ensureIndex({foo: 1});
+t.ensureIndex({bar: 1});
+t.ensureIndex({baz: 1});
// Scan foo <= 20
ixscan1 = {ixscan: {args:{name: "stages_and_hashed", keyPattern:{foo: 1},
@@ -24,7 +24,7 @@ ixscan2 = {ixscan: {args:{name: "stages_and_hashed", keyPattern:{bar: 1},
// bar = 50 - foo
// Intersection is (foo=0 bar=50, foo=1 bar=49, ..., foo=10 bar=40)
-andix1ix2 = {andHash: {args: { nodes: [ixscan1, ixscan2]}}}
+andix1ix2 = {andHash: {args: { nodes: [ixscan1, ixscan2]}}};
res = db.runCommand({stageDebug: {plan: andix1ix2, collection: collname}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 11);
diff --git a/jstests/core/stages_and_sorted.js b/jstests/core/stages_and_sorted.js
index 9b7bf7ad415..e6e493de5f7 100644
--- a/jstests/core/stages_and_sorted.js
+++ b/jstests/core/stages_and_sorted.js
@@ -12,7 +12,7 @@ for (var i = 0; i < N; ++i) {
// This is the only thing that should be outputted in the and.
t.insert({foo: 1, bar:1, baz: 12});
t.insert({bar: 1});
- t.insert({bar:1, baz: 12})
+ t.insert({bar:1, baz: 12});
t.insert({baz: 12});
t.insert({foo: 1, baz: 12});
t.insert({baz: 12});
diff --git a/jstests/core/stages_collection_scan.js b/jstests/core/stages_collection_scan.js
index fe93a9b6bf0..fddd22f624a 100644
--- a/jstests/core/stages_collection_scan.js
+++ b/jstests/core/stages_collection_scan.js
@@ -8,7 +8,7 @@ for (var i = 0; i < N; ++i) {
t.insert({foo: i});
}
-forward = {cscan: {args: {direction: 1}}}
+forward = {cscan: {args: {direction: 1}}};
res = db.runCommand({stageDebug: {collection: collname, plan: forward}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, N);
@@ -16,7 +16,7 @@ assert.eq(res.results[0].foo, 0);
assert.eq(res.results[49].foo, 49);
// And, backwards.
-backward = {cscan: {args: {direction: -1}}}
+backward = {cscan: {args: {direction: -1}}};
res = db.runCommand({stageDebug: {collection: collname, plan: backward}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, N);
@@ -24,7 +24,7 @@ assert.eq(res.results[0].foo, 49);
assert.eq(res.results[49].foo, 0);
forwardFiltered = {cscan: {args: {direction: 1},
- filter: {foo: {$lt: 25}}}}
+ filter: {foo: {$lt: 25}}}};
res = db.runCommand({stageDebug: {collection: collname, plan: forwardFiltered}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 25);
@@ -32,7 +32,7 @@ assert.eq(res.results[0].foo, 0);
assert.eq(res.results[24].foo, 24);
backwardFiltered = {cscan: {args: {direction: -1},
- filter: {foo: {$lt: 25}}}}
+ filter: {foo: {$lt: 25}}}};
res = db.runCommand({stageDebug: {collection: collname, plan: backwardFiltered}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 25);
diff --git a/jstests/core/stages_fetch.js b/jstests/core/stages_fetch.js
index 02b209295d9..2bff065a5d7 100644
--- a/jstests/core/stages_fetch.js
+++ b/jstests/core/stages_fetch.js
@@ -24,8 +24,8 @@ assert.eq(res.ok, 0);
ixscan2 = {ixscan: {args:{keyPattern:{foo:1},
startKey: {"": 20},
endKey: {"" : 30}, endKeyInclusive: true,
- direction: 1}}}
-fetch = {fetch: {args: {node: ixscan2}, filter: {bar: 25}}}
+ direction: 1}}};
+fetch = {fetch: {args: {node: ixscan2}, filter: {bar: 25}}};
res = db.runCommand({stageDebug: {collection: collname, plan: fetch}});
printjson(res);
assert.eq(res.ok, 1);
diff --git a/jstests/core/stages_ixscan.js b/jstests/core/stages_ixscan.js
index f8947e2e4a5..3f920f70241 100644
--- a/jstests/core/stages_ixscan.js
+++ b/jstests/core/stages_ixscan.js
@@ -8,7 +8,7 @@ for (var i = 0; i < N; ++i) {
t.insert({foo: i, bar: N - i, baz: i});
}
-t.ensureIndex({foo: 1})
+t.ensureIndex({foo: 1});
t.ensureIndex({foo: 1, baz: 1});
// foo <= 20
diff --git a/jstests/core/stages_limit_skip.js b/jstests/core/stages_limit_skip.js
index 4586033cfff..7ca7b89b180 100644
--- a/jstests/core/stages_limit_skip.js
+++ b/jstests/core/stages_limit_skip.js
@@ -8,7 +8,7 @@ for (var i = 0; i < N; ++i) {
t.insert({foo: i, bar: N - i, baz: i});
}
-t.ensureIndex({foo: 1})
+t.ensureIndex({foo: 1});
// foo <= 20, decreasing
// Limit of 5 results.
@@ -16,7 +16,7 @@ ixscan1 = {ixscan: {args:{keyPattern:{foo: 1},
startKey: {"": 20},
endKey: {}, endKeyInclusive: true,
direction: -1}}};
-limit1 = {limit: {args: {node: ixscan1, num: 5}}}
+limit1 = {limit: {args: {node: ixscan1, num: 5}}};
res = db.runCommand({stageDebug: {collection: collname, plan: limit1}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 5);
@@ -25,7 +25,7 @@ assert.eq(res.results[4].foo, 16);
// foo <= 20, decreasing
// Skip 5 results.
-skip1 = {skip: {args: {node: ixscan1, num: 5}}}
+skip1 = {skip: {args: {node: ixscan1, num: 5}}};
res = db.runCommand({stageDebug: {collection: collname, plan: skip1}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 16);
diff --git a/jstests/core/stages_mergesort.js b/jstests/core/stages_mergesort.js
index 5f5c5d74336..18c52bef40c 100644
--- a/jstests/core/stages_mergesort.js
+++ b/jstests/core/stages_mergesort.js
@@ -6,11 +6,11 @@ var collname = "stages_mergesort";
var N = 10;
for (var i = 0; i < N; ++i) {
t.insert({foo: 1, bar: N - i - 1});
- t.insert({baz: 1, bar: i})
+ t.insert({baz: 1, bar: i});
}
-t.ensureIndex({foo: 1, bar:1})
-t.ensureIndex({baz: 1, bar:1})
+t.ensureIndex({foo: 1, bar:1});
+t.ensureIndex({baz: 1, bar:1});
// foo == 1
// We would (internally) use "": MinKey and "": MaxKey for the bar index bounds.
diff --git a/jstests/core/stages_or.js b/jstests/core/stages_or.js
index 92f85b15694..0d4a47c5e06 100644
--- a/jstests/core/stages_or.js
+++ b/jstests/core/stages_or.js
@@ -8,9 +8,9 @@ for (var i = 0; i < N; ++i) {
t.insert({foo: i, bar: N - i, baz: i});
}
-t.ensureIndex({foo: 1})
-t.ensureIndex({bar: 1})
-t.ensureIndex({baz: 1})
+t.ensureIndex({foo: 1});
+t.ensureIndex({bar: 1});
+t.ensureIndex({baz: 1});
// baz >= 40
ixscan1 = {ixscan: {args:{keyPattern:{baz: 1},
diff --git a/jstests/core/stages_sort.js b/jstests/core/stages_sort.js
index 5dd9340b2d6..89b71a28f8b 100644
--- a/jstests/core/stages_sort.js
+++ b/jstests/core/stages_sort.js
@@ -8,7 +8,7 @@ if (false) {
t.insert({foo: i, bar: N - i});
}
- t.ensureIndex({foo: 1})
+ t.ensureIndex({foo: 1});
// Foo <= 20, descending.
ixscan1 = {ixscan: {args:{name: "stages_sort", keyPattern:{foo: 1},
diff --git a/jstests/core/stages_text.js b/jstests/core/stages_text.js
index 077416b98af..6598d135b9f 100644
--- a/jstests/core/stages_text.js
+++ b/jstests/core/stages_text.js
@@ -4,9 +4,9 @@ t = db.stages_text;
t.drop();
var collname = "stages_text";
-t.save({x: "az b x"})
+t.save({x: "az b x"});
-t.ensureIndex({x: "text"})
+t.ensureIndex({x: "text"});
// We expect to retrieve 'b'
res = db.runCommand({stageDebug: {collection: collname,
diff --git a/jstests/core/storefunc.js b/jstests/core/storefunc.js
index 3b5fc1ab9ab..fae9e58bfa4 100644
--- a/jstests/core/storefunc.js
+++ b/jstests/core/storefunc.js
@@ -39,7 +39,7 @@ assert( s.getIndexKeys().length > 0 , "no indexes" );
assert( s.getIndexKeys()[0]._id , "no _id index" );
assert.eq( "undefined" , testdb.eval( function(){ return typeof(zzz); } ) , "C1" );
-s.save( { _id : "zzz" , value : 5 } )
+s.save( { _id : "zzz" , value : 5 } );
assert.eq( "number" , testdb.eval( function(){ return typeof(zzz); } ) , "C2" );
s.remove( { _id : "zzz" } );
assert.eq( "undefined" , testdb.eval( function(){ return typeof(zzz); } ) , "C3" );
diff --git a/jstests/core/sub1.js b/jstests/core/sub1.js
index 9e643f811fd..324b21b75e8 100644
--- a/jstests/core/sub1.js
+++ b/jstests/core/sub1.js
@@ -3,7 +3,7 @@
t = db.sub1;
t.drop();
-x = { a : 1 , b : { c : { d : 2 } } }
+x = { a : 1 , b : { c : { d : 2 } } };
t.save( x );
diff --git a/jstests/core/tailable_skip_limit.js b/jstests/core/tailable_skip_limit.js
index bfb88778910..da2f80d0311 100644
--- a/jstests/core/tailable_skip_limit.js
+++ b/jstests/core/tailable_skip_limit.js
@@ -3,7 +3,7 @@
"use strict";
// Setup the capped collection.
- var collname = "jstests_tailable_skip_limit"
+ var collname = "jstests_tailable_skip_limit";
var t = db[collname];
t.drop();
db.createCollection(collname, {capped: true, size: 1024});
diff --git a/jstests/core/temp_cleanup.js b/jstests/core/temp_cleanup.js
index e827083d605..d9dc7fdcccf 100644
--- a/jstests/core/temp_cleanup.js
+++ b/jstests/core/temp_cleanup.js
@@ -1,16 +1,16 @@
-mydb = db.getSisterDB( "temp_cleanup_test" )
+mydb = db.getSisterDB( "temp_cleanup_test" );
-t = mydb.tempCleanup
-t.drop()
+t = mydb.tempCleanup;
+t.drop();
-t.insert( { x : 1 } )
+t.insert( { x : 1 } );
res = t.mapReduce( function(){ emit(1,1); } , function(){ return 1; } , "xyz" );
printjson( res );
-assert.eq( 1 , t.count() , "A1" )
-assert.eq( 1 , mydb[res.result].count() , "A2" )
+assert.eq( 1 , t.count() , "A1" );
+assert.eq( 1 , mydb[res.result].count() , "A2" );
-mydb.dropDatabase()
+mydb.dropDatabase();
diff --git a/jstests/core/top.js b/jstests/core/top.js
index 7fa0dbac39c..9dc1aad684e 100644
--- a/jstests/core/top.js
+++ b/jstests/core/top.js
@@ -24,7 +24,7 @@ var lastTop = getTop();
function diffTop(key) {
var thisTop = getTop();
difference = { time : thisTop[key].time - lastTop[key].time,
- count : thisTop[key].count - lastTop[key].count }
+ count : thisTop[key].count - lastTop[key].count };
lastTop[key] = thisTop[key];
assert.gte(difference.count, 0, "non-decreasing count");
@@ -38,9 +38,9 @@ function diffTop(key) {
var numRecords = 100;
// check stats for specified key are as expected
-var checked = { }
+var checked = { };
function checkStats(key, expected) {
- checked[key]++
+ checked[key]++;
var actual = diffTop(key).count;
assert.eq(actual, expected, "top reports wrong count for " + key);
}
@@ -59,7 +59,7 @@ for(i = 0; i < numRecords; i++) {
checkStats("update", numRecords);
// Queries
-var query = { }
+var query = { };
for(i = 0; i < numRecords; i++) {
query[i] = testColl.find({x : {$gte:i}}).batchSize(2);
assert.eq(query[i].next()._id, i);
diff --git a/jstests/core/ts1.js b/jstests/core/ts1.js
index 30f7882e863..34efa15f981 100644
--- a/jstests/core/ts1.js
+++ b/jstests/core/ts1.js
@@ -1,11 +1,11 @@
-t = db.ts1
-t.drop()
+t = db.ts1;
+t.drop();
-N = 20
+N = 20;
for ( i=0; i<N; i++ ){
- t.insert( { _id : i , x : new Timestamp() } )
- sleep( 100 )
+ t.insert( { _id : i , x : new Timestamp() } );
+ sleep( 100 );
}
function get(i){
@@ -25,14 +25,14 @@ for ( i=0; i<N-1; i++ ){
a = get(i);
b = get(i+1);
//print( tojson(a) + "\t" + tojson(b) + "\t" + cmp(a,b) );
- assert.gt( 0 , cmp( a , b ) , "cmp " + i )
+ assert.gt( 0 , cmp( a , b ) , "cmp " + i );
}
-assert.eq( N , t.find( { x : { $type : 17 } } ).itcount() , "B1" )
-assert.eq( 0 , t.find( { x : { $type : 3 } } ).itcount() , "B2" )
+assert.eq( N , t.find( { x : { $type : 17 } } ).itcount() , "B1" );
+assert.eq( 0 , t.find( { x : { $type : 3 } } ).itcount() , "B2" );
-t.insert( { _id : 100 , x : new Timestamp( 123456 , 50 ) } )
-x = t.findOne( { _id : 100 } ).x
-assert.eq( 123456 , x.t , "C1" )
-assert.eq( 50 , x.i , "C2" )
+t.insert( { _id : 100 , x : new Timestamp( 123456 , 50 ) } );
+x = t.findOne( { _id : 100 } ).x;
+assert.eq( 123456 , x.t , "C1" );
+assert.eq( 50 , x.i , "C2" );
diff --git a/jstests/core/update3.js b/jstests/core/update3.js
index 995c6e67b45..d29d073a40a 100644
--- a/jstests/core/update3.js
+++ b/jstests/core/update3.js
@@ -23,6 +23,6 @@ f.update( {}, {$set:{'_id':5}} );
assert.eq( 0, f.findOne()._id , "D" );
f.drop();
-f.save({_id:1, a:1})
-f.update({}, {$unset:{"a":1, "b.c":1}})
-assert.docEq(f.findOne(), {_id:1}, "E") \ No newline at end of file
+f.save({_id:1, a:1});
+f.update({}, {$unset:{"a":1, "b.c":1}});
+assert.docEq(f.findOne(), {_id:1}, "E"); \ No newline at end of file
diff --git a/jstests/core/update6.js b/jstests/core/update6.js
index 23d5846c206..eda470abf45 100644
--- a/jstests/core/update6.js
+++ b/jstests/core/update6.js
@@ -24,7 +24,7 @@ t.save( {"_id" : 2 ,
assert.eq( 4 , Object.keySet( t.find({_id:2},{b3:1})[0].b3 ).length , "test 1 : ks before" );
-t.update({_id:2},{$inc: { 'b3.0719' : 1}},true)
+t.update({_id:2},{$inc: { 'b3.0719' : 1}},true);
assert.eq( 5 , Object.keySet( t.find({_id:2},{b3:1})[0].b3 ).length , "test 1 : ks after" );
@@ -40,7 +40,7 @@ t.save( {"_id" : 2 ,
assert.eq( 4 , Object.keySet( t.find({_id:2},{b3:1})[0].b3 ).length , "test 2 : ks before" );
-printjson( t.find({_id:2},{b3:1})[0].b3 )
-t.update({_id:2},{$inc: { 'b3.0719' : 1}} )
-printjson( t.find({_id:2},{b3:1})[0].b3 )
+printjson( t.find({_id:2},{b3:1})[0].b3 );
+t.update({_id:2},{$inc: { 'b3.0719' : 1}} );
+printjson( t.find({_id:2},{b3:1})[0].b3 );
assert.eq( 5 , Object.keySet( t.find({_id:2},{b3:1})[0].b3 ).length , "test 2 : ks after" );
diff --git a/jstests/core/update7.js b/jstests/core/update7.js
index b893121080f..199a331f9b2 100644
--- a/jstests/core/update7.js
+++ b/jstests/core/update7.js
@@ -133,6 +133,6 @@ t.save( { x : 3 } );
t.ensureIndex( { x : 1 } );
-assert.eq( "1,2,3" , s() , "F1" )
+assert.eq( "1,2,3" , s() , "F1" );
t.update( { x : { $gt : 0 } } , { $inc : { x : 5 } } , false , true );
-assert.eq( "6,7,8" , s() , "F1" )
+assert.eq( "6,7,8" , s() , "F1" );
diff --git a/jstests/core/update8.js b/jstests/core/update8.js
index 2388ff85c9d..f59bea15e15 100644
--- a/jstests/core/update8.js
+++ b/jstests/core/update8.js
@@ -2,10 +2,10 @@
t = db.update8;
t.drop();
-t.update( { _id : 1 , tags: {"$ne": "a"}}, {"$push": { tags : "a" } } , true )
+t.update( { _id : 1 , tags: {"$ne": "a"}}, {"$push": { tags : "a" } } , true );
assert.eq( { _id : 1 , tags : [ "a" ] } , t.findOne() , "A" );
-t.drop()
+t.drop();
//SERVER-390
//t.update( { "x.y" : 1 } , { $inc : { i : 1 } } , true );
//printjson( t.findOne() );
diff --git a/jstests/core/update9.js b/jstests/core/update9.js
index 45b9e2d0e26..0a51d658199 100644
--- a/jstests/core/update9.js
+++ b/jstests/core/update9.js
@@ -1,18 +1,18 @@
t = db.update9;
-t.drop()
+t.drop();
orig = { "_id" : 1 ,
"question" : "a",
"choices" : { "1" : { "choice" : "b" },
"0" : { "choice" : "c" } } ,
- }
+ };
t.save( orig );
assert.eq( orig , t.findOne() , "A" );
-t.update({_id: 1, 'choices.0.votes': {$ne: 1}}, {$push: {'choices.0.votes': 1}})
+t.update({_id: 1, 'choices.0.votes': {$ne: 1}}, {$push: {'choices.0.votes': 1}});
orig.choices["0"].votes = [ 1 ] ;
assert.eq( orig.choices["0"] , t.findOne().choices["0"] , "B" );
diff --git a/jstests/core/update_addToSet.js b/jstests/core/update_addToSet.js
index da930555267..c12f029f6ae 100644
--- a/jstests/core/update_addToSet.js
+++ b/jstests/core/update_addToSet.js
@@ -2,7 +2,7 @@
t = db.update_addToSet1;
t.drop();
-o = { _id : 1 , a : [ 2 , 1 ] }
+o = { _id : 1 , a : [ 2 , 1 ] };
t.insert( o );
assert.eq( o , t.findOne() , "A1" );
@@ -16,12 +16,12 @@ assert.eq( o , t.findOne() , "A3" );
// SERVER-628
t.update( {} , { $addToSet : { a : { $each : [ 3 , 5 , 6 ] } } } );
-o.a.push( 5 )
-o.a.push( 6 )
-assert.eq( o , t.findOne() , "B1" )
+o.a.push( 5 );
+o.a.push( 6 );
+assert.eq( o , t.findOne() , "B1" );
-t.drop()
-o = { _id : 1 , a : [ 3 , 5 , 6 ] }
+t.drop();
+o = { _id : 1 , a : [ 3 , 5 , 6 ] };
t.insert( o );
t.update( {} , { $addToSet : { a : { $each : [ 3 , 5 , 6 ] } } } );
assert.eq( o , t.findOne() , "B2" );
diff --git a/jstests/core/update_addToSet2.js b/jstests/core/update_addToSet2.js
index cb168f8d15e..dd73a4f3531 100644
--- a/jstests/core/update_addToSet2.js
+++ b/jstests/core/update_addToSet2.js
@@ -1,11 +1,11 @@
-t = db.update_addToSet2
+t = db.update_addToSet2;
t.drop();
-o = { _id : 1 }
+o = { _id : 1 };
t.insert( { _id : 1 } );
-t.update({},{$addToSet : {'kids' :{ 'name' : 'Bob', 'age': '4'}}})
-t.update({},{$addToSet : {'kids' :{ 'name' : 'Dan', 'age': '2'}}})
+t.update({},{$addToSet : {'kids' :{ 'name' : 'Bob', 'age': '4'}}});
+t.update({},{$addToSet : {'kids' :{ 'name' : 'Dan', 'age': '2'}}});
printjson( t.findOne() );
diff --git a/jstests/core/update_addToSet3.js b/jstests/core/update_addToSet3.js
index e9da58eb6e0..fb6df7645f0 100644
--- a/jstests/core/update_addToSet3.js
+++ b/jstests/core/update_addToSet3.js
@@ -1,18 +1,18 @@
-t = db.update_addToSet3
-t.drop()
+t = db.update_addToSet3;
+t.drop();
-t.insert( { _id : 1 } )
+t.insert( { _id : 1 } );
-t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 6 , 5 , 4 ] } } } )
-assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 ] } , "A1" )
+t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 6 , 5 , 4 ] } } } );
+assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 ] } , "A1" );
-t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 3 , 2 , 1 ] } } } )
-assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 ] } , "A2" )
+t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 3 , 2 , 1 ] } } } );
+assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 ] } , "A2" );
-t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 4 , 7 , 9 , 2 ] } } } )
-assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 , 7 , 9 ] } , "A3" )
+t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 4 , 7 , 9 , 2 ] } } } );
+assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 , 7 , 9 ] } , "A3" );
-t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 12 , 13 , 12 ] } } } )
-assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 , 7 , 9 , 12 , 13 ] } , "A4" )
+t.update( { _id : 1 } , { $addToSet : { a : { $each : [ 12 , 13 , 12 ] } } } );
+assert.eq( t.findOne() , { _id : 1 , a : [ 6 , 5 , 4 , 3 , 2 , 1 , 7 , 9 , 12 , 13 ] } , "A4" );
diff --git a/jstests/core/update_arraymatch1.js b/jstests/core/update_arraymatch1.js
index 521271d7f85..9c1907b63f2 100644
--- a/jstests/core/update_arraymatch1.js
+++ b/jstests/core/update_arraymatch1.js
@@ -1,16 +1,16 @@
-t = db.update_arraymatch1
+t = db.update_arraymatch1;
t.drop();
-o = { _id : 1 , a : [ { x : 1 , y : 1 } , { x : 2 , y : 2 } , { x : 3 , y : 3 } ] }
+o = { _id : 1 , a : [ { x : 1 , y : 1 } , { x : 2 , y : 2 } , { x : 3 , y : 3 } ] };
t.insert( o );
assert.eq( o , t.findOne() , "A1" );
-q = { "a.x" : 2 }
-t.update( q , { $set : { b : 5 } } )
-o.b = 5
-assert.eq( o , t.findOne() , "A2" )
+q = { "a.x" : 2 };
+t.update( q , { $set : { b : 5 } } );
+o.b = 5;
+assert.eq( o , t.findOne() , "A2" );
-t.update( { "a.x" : 2 } , { $inc : { "a.$.y" : 1 } } )
+t.update( { "a.x" : 2 } , { $inc : { "a.$.y" : 1 } } );
o.a[1].y++;
assert.eq( o , t.findOne() , "A3" );
diff --git a/jstests/core/update_arraymatch2.js b/jstests/core/update_arraymatch2.js
index c07a61c378c..fc1e2f93fc5 100644
--- a/jstests/core/update_arraymatch2.js
+++ b/jstests/core/update_arraymatch2.js
@@ -7,8 +7,8 @@ t.insert( { x : 99 } );
t.update( {x : 2}, { $inc : { "x.$" : 1 } } , false, true );
assert( t.findOne({x:1}).x[1] == 3, "A1" );
-t.insert( { x : { y : [8,7,6] } } )
-t.update( {'x.y' : 7}, { $inc : { "x.y.$" : 1 } } , false, true )
+t.insert( { x : { y : [8,7,6] } } );
+t.update( {'x.y' : 7}, { $inc : { "x.y.$" : 1 } } , false, true );
assert.eq( 8 , t.findOne({"x.y" : 8}).x.y[1] , "B1" );
t.insert( { x : [90,91,92], y : ['a', 'b', 'c'] } );
diff --git a/jstests/core/update_arraymatch3.js b/jstests/core/update_arraymatch3.js
index 116ac6be2e3..96fa0a5cbb5 100644
--- a/jstests/core/update_arraymatch3.js
+++ b/jstests/core/update_arraymatch3.js
@@ -7,11 +7,11 @@ o = { _id : 1 ,
comments : [ { "by" : "joe", "votes" : 3 },
{ "by" : "jane", "votes" : 7 }
]
- }
+ };
t.save( o );
assert.eq( o , t.findOne() , "A1" );
-t.update( {'comments.by':'joe'}, {$inc:{'comments.$.votes':1}}, false, true )
+t.update( {'comments.by':'joe'}, {$inc:{'comments.$.votes':1}}, false, true );
o.comments[0].votes++;
assert.eq( o , t.findOne() , "A2" );
diff --git a/jstests/core/update_arraymatch4.js b/jstests/core/update_arraymatch4.js
index 5abd0aa3bf0..d445168ca25 100644
--- a/jstests/core/update_arraymatch4.js
+++ b/jstests/core/update_arraymatch4.js
@@ -1,18 +1,18 @@
-t = db.update_arraymatch4
-t.drop()
+t = db.update_arraymatch4;
+t.drop();
-x = { _id : 1 , arr : ["A1","B1","C1"] }
-t.insert( x )
-assert.eq( x , t.findOne() , "A1" )
+x = { _id : 1 , arr : ["A1","B1","C1"] };
+t.insert( x );
+assert.eq( x , t.findOne() , "A1" );
-x.arr[0] = "A2"
-t.update( { arr : "A1" } , { $set : { "arr.$" : "A2" } } )
-assert.eq( x , t.findOne() , "A2" )
+x.arr[0] = "A2";
+t.update( { arr : "A1" } , { $set : { "arr.$" : "A2" } } );
+assert.eq( x , t.findOne() , "A2" );
-t.ensureIndex( { arr : 1 } )
-x.arr[0] = "A3"
-t.update( { arr : "A2" } , { $set : { "arr.$" : "A3" } } )
+t.ensureIndex( { arr : 1 } );
+x.arr[0] = "A3";
+t.update( { arr : "A2" } , { $set : { "arr.$" : "A3" } } );
assert.eq( x , t.findOne() , "A3" ); // SERVER-1055
diff --git a/jstests/core/update_arraymatch5.js b/jstests/core/update_arraymatch5.js
index aff1a0323ef..b468d0113ea 100644
--- a/jstests/core/update_arraymatch5.js
+++ b/jstests/core/update_arraymatch5.js
@@ -1,15 +1,15 @@
-t = db.update_arraymatch5
+t = db.update_arraymatch5;
t.drop();
t.insert({abc:{visible:true}, testarray:[{foobar_id:316, visible:true, xxx: 1}]});
t.ensureIndex({'abc.visible':1, 'testarray.visible':1 , 'testarray.xxx': 1});
-assert( t.findOne({'abc.visible':true, testarray:{'$elemMatch': {visible:true, xxx:1}}}) , "A1" )
+assert( t.findOne({'abc.visible':true, testarray:{'$elemMatch': {visible:true, xxx:1}}}) , "A1" );
assert( t.findOne({testarray:{'$elemMatch': {visible:true, xxx:1}}}) , "A2" );
t.update({'testarray.foobar_id':316}, {'$set': {'testarray.$.visible': true, 'testarray.$.xxx': 2}}, false, true);
assert( t.findOne() , "B1" );
-assert( t.findOne({testarray:{'$elemMatch': {visible:true, xxx:2}}}) , "B2" )
+assert( t.findOne({testarray:{'$elemMatch': {visible:true, xxx:2}}}) , "B2" );
assert( t.findOne({'abc.visible':true, testarray:{'$elemMatch': {visible:true, xxx:2}}}) , "B3" );
assert.eq( 1 , t.find().count() , "B4" );
diff --git a/jstests/core/update_arraymatch6.js b/jstests/core/update_arraymatch6.js
index 1fd6d32ab16..71e443fa44f 100644
--- a/jstests/core/update_arraymatch6.js
+++ b/jstests/core/update_arraymatch6.js
@@ -5,7 +5,7 @@ t.drop();
function doTest() {
t.save( {a: [{id: 1, x: [5,6,7]}, {id: 2, x: [8,9,10]}]} );
res = t.update({'a.id': 1}, {$set: {'a.$.x': [1,1,1]}});
- assert.writeOK( res )
+ assert.writeOK( res );
assert.eq.automsg( "1", "t.findOne().a[ 0 ].x[ 0 ]" );
}
diff --git a/jstests/core/update_bit_examples.js b/jstests/core/update_bit_examples.js
index 8cce3a938ac..3374b502055 100644
--- a/jstests/core/update_bit_examples.js
+++ b/jstests/core/update_bit_examples.js
@@ -4,25 +4,25 @@ var coll = db.update_bit;
coll.drop();
// $bit and
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:NumberInt(2)});
-res = coll.update({}, {$bit: {a: {and: NumberInt(4)}}})
+res = coll.update({}, {$bit: {a: {and: NumberInt(4)}}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 0)
+assert.eq(coll.findOne().a, 0);
// $bit or
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:NumberInt(2)});
-res = coll.update({}, {$bit: {a: {or: NumberInt(4)}}})
+res = coll.update({}, {$bit: {a: {or: NumberInt(4)}}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 6)
+assert.eq(coll.findOne().a, 6);
// $bit xor
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:NumberInt(0)});
-res = coll.update({}, {$bit: {a: {xor: NumberInt(4)}}})
+res = coll.update({}, {$bit: {a: {xor: NumberInt(4)}}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 4)
+assert.eq(coll.findOne().a, 4);
// SERVER-19706 Empty bit operation.
res = coll.update({}, {$bit: {a: {}}});
diff --git a/jstests/core/update_blank1.js b/jstests/core/update_blank1.js
index 94a083b306f..8fe58419ddc 100644
--- a/jstests/core/update_blank1.js
+++ b/jstests/core/update_blank1.js
@@ -1,5 +1,5 @@
-t = db.update_blank1
+t = db.update_blank1;
t.drop();
orig = { "" : 1 , _id : 2 , "a" : 3 , "b" : 4 };
diff --git a/jstests/core/update_currentdate_examples.js b/jstests/core/update_currentdate_examples.js
index f6270c62871..3430c261481 100644
--- a/jstests/core/update_currentdate_examples.js
+++ b/jstests/core/update_currentdate_examples.js
@@ -4,22 +4,22 @@ var coll = db.update_currentdate;
coll.drop();
// $currentDate default
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$currentDate: {a: true}})
+res = coll.update({}, {$currentDate: {a: true}});
assert.writeOK(res);
-assert(coll.findOne().a.constructor == Date)
+assert(coll.findOne().a.constructor == Date);
// $currentDate type = date
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$currentDate: {a: {$type: "date"}}})
+res = coll.update({}, {$currentDate: {a: {$type: "date"}}});
assert.writeOK(res);
-assert(coll.findOne().a.constructor == Date)
+assert(coll.findOne().a.constructor == Date);
// $currentDate type = timestamp
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$currentDate: {a: {$type: "timestamp"}}})
+res = coll.update({}, {$currentDate: {a: {$type: "timestamp"}}});
assert.writeOK(res);
-assert(coll.findOne().a.constructor == Timestamp)
+assert(coll.findOne().a.constructor == Timestamp);
diff --git a/jstests/core/update_invalid1.js b/jstests/core/update_invalid1.js
index 7c94507f560..46b68f7db63 100644
--- a/jstests/core/update_invalid1.js
+++ b/jstests/core/update_invalid1.js
@@ -1,6 +1,6 @@
-t = db.update_invalid1
-t.drop()
+t = db.update_invalid1;
+t.drop();
t.update( { _id : 5 } , { $set : { $inc : { x : 5 } } } , true );
assert.eq( 0 , t.count() , "A1" );
diff --git a/jstests/core/update_min_max_examples.js b/jstests/core/update_min_max_examples.js
index a8463d7c300..7acfd5bb45b 100644
--- a/jstests/core/update_min_max_examples.js
+++ b/jstests/core/update_min_max_examples.js
@@ -5,31 +5,31 @@ coll.drop();
// $min for number
coll.insert({_id:1, a:2});
-res = coll.update({_id:1}, {$min: {a: 1}})
+res = coll.update({_id:1}, {$min: {a: 1}});
assert.writeOK(res);
-assert.eq(coll.findOne({_id:1}).a, 1)
+assert.eq(coll.findOne({_id:1}).a, 1);
// $max for number
coll.insert({_id:2, a:2});
-res = coll.update({_id:2}, {$max: {a: 1}})
+res = coll.update({_id:2}, {$max: {a: 1}});
assert.writeOK(res);
-assert.eq(coll.findOne({_id:2}).a, 2)
+assert.eq(coll.findOne({_id:2}).a, 2);
// $min for Date
coll.insert({_id:3, a: new Date()});
-var origDoc = coll.findOne({_id:3})
-sleep(2)
-res = coll.update({_id:3}, {$min: {a: new Date()}})
+var origDoc = coll.findOne({_id:3});
+sleep(2);
+res = coll.update({_id:3}, {$min: {a: new Date()}});
assert.writeOK(res);
-assert.eq(coll.findOne({_id:3}).a, origDoc.a)
+assert.eq(coll.findOne({_id:3}).a, origDoc.a);
// $max for Date
coll.insert({_id:4, a: new Date()});
-sleep(2)
+sleep(2);
var newDate = new Date();
-res = coll.update({_id:4}, {$max: {a: newDate}})
+res = coll.update({_id:4}, {$max: {a: newDate}});
assert.writeOK(res);
-assert.eq(coll.findOne({_id:4}).a, newDate)
+assert.eq(coll.findOne({_id:4}).a, newDate);
// $max for small number
coll.insert({_id:5, a: 1e-15 });
diff --git a/jstests/core/update_mul_examples.js b/jstests/core/update_mul_examples.js
index 71d481eb064..36738b93990 100644
--- a/jstests/core/update_mul_examples.js
+++ b/jstests/core/update_mul_examples.js
@@ -4,36 +4,36 @@ var coll = db.update_mul;
coll.drop();
// $mul positive
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$mul: {a: 10}})
+res = coll.update({}, {$mul: {a: 10}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 20)
+assert.eq(coll.findOne().a, 20);
// $mul negative
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$mul: {a: -10}})
+res = coll.update({}, {$mul: {a: -10}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, -20)
+assert.eq(coll.findOne().a, -20);
// $mul zero
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$mul: {a: 0}})
+res = coll.update({}, {$mul: {a: 0}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 0)
+assert.eq(coll.findOne().a, 0);
// $mul decimal
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$mul: {a: 1.1}})
+res = coll.update({}, {$mul: {a: 1.1}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, 2.2)
+assert.eq(coll.findOne().a, 2.2);
// $mul negative decimal
-coll.remove({})
+coll.remove({});
coll.save({_id:1, a:2});
-res = coll.update({}, {$mul: {a: -0.1}})
+res = coll.update({}, {$mul: {a: -0.1}});
assert.writeOK(res);
-assert.eq(coll.findOne().a, -0.2)
+assert.eq(coll.findOne().a, -0.2);
diff --git a/jstests/core/update_multi3.js b/jstests/core/update_multi3.js
index 903d8265b63..38341dcd13f 100644
--- a/jstests/core/update_multi3.js
+++ b/jstests/core/update_multi3.js
@@ -5,7 +5,7 @@ function test( useIndex ){
t.drop();
if ( useIndex )
- t.ensureIndex({k:1})
+ t.ensureIndex({k:1});
for (i=0; i<10; i++) {
t.save({ _id : i , k: 'x', a: []});
@@ -15,11 +15,11 @@ function test( useIndex ){
t.find( { k : "x" } ).forEach(
function(z){
- assert.eq( [ "y" ] , z.a , "useIndex: " + useIndex )
+ assert.eq( [ "y" ] , z.a , "useIndex: " + useIndex );
}
);
}
-test( false )
-test( true )
+test( false );
+test( true );
diff --git a/jstests/core/update_multi4.js b/jstests/core/update_multi4.js
index e81a19a5feb..f290894298c 100644
--- a/jstests/core/update_multi4.js
+++ b/jstests/core/update_multi4.js
@@ -8,11 +8,11 @@ for(i=0;i<1000;i++){
v:"v"+i%12 } );
}
-t.ensureIndex({k:1})
+t.ensureIndex({k:1});
assert.eq( 84 , t.count({k:2,v:"v2"} ) , "A0" );
-t.update({k:2},{$set:{v:"two v2"}},false,true)
+t.update({k:2},{$set:{v:"two v2"}},false,true);
assert.eq( 0 , t.count({k:2,v:"v2"} ) , "A1" );
assert.eq( 84 , t.count({k:2,v:"two v2"} ) , "A2" );
diff --git a/jstests/core/update_multi5.js b/jstests/core/update_multi5.js
index 46ef8f36da5..c6d51ef0196 100644
--- a/jstests/core/update_multi5.js
+++ b/jstests/core/update_multi5.js
@@ -1,7 +1,7 @@
t = db.update_multi5;
-t.drop()
+t.drop();
t.insert({path: 'r1', subscribers: [1,2]});
t.insert({path: 'r2', subscribers: [3,4]});
diff --git a/jstests/core/update_multi6.js b/jstests/core/update_multi6.js
index 57733c37e38..39434d3f512 100644
--- a/jstests/core/update_multi6.js
+++ b/jstests/core/update_multi6.js
@@ -1,10 +1,10 @@
var res;
-t = db.update_multi6
+t = db.update_multi6;
t.drop();
t.update( { _id : 1 } , { _id : 1 , x : 1 , y : 2 } , true , false );
-assert( t.findOne( { _id : 1 } ) , "A" )
+assert( t.findOne( { _id : 1 } ) , "A" );
res = t.update( { _id : 2 } , { _id : 2 , x : 1 , y : 2 } , true , true );
assert.writeError( res );
diff --git a/jstests/core/update_replace.js b/jstests/core/update_replace.js
index ebfe2a0bd6f..54f13f7ded2 100644
--- a/jstests/core/update_replace.js
+++ b/jstests/core/update_replace.js
@@ -14,39 +14,39 @@ var res;
conn._skipValidation = true;
// Should not allow "." in field names
-res = t.save({_id:1, "a.a":1})
+res = t.save({_id:1, "a.a":1});
assert(res.hasWriteError(), "a.a");
// Should not allow "." in field names, embedded
-res = t.save({_id:1, a :{"a.a":1}})
+res = t.save({_id:1, a :{"a.a":1}});
assert(res.hasWriteError(), "a: a.a");
// Should not allow "$"-prefixed field names, caught before "." check
-res = t.save({_id:1, $a :{"a.a":1}})
+res = t.save({_id:1, $a :{"a.a":1}});
assert(res.hasWriteError(), "$a: a.a");
// Should not allow "$"-prefixed field names
-res = t.save({_id:1, $a: 1})
+res = t.save({_id:1, $a: 1});
assert(res.hasWriteError(), "$a");
// _id validation checks
// Should not allow regex _id
-res = t.save({_id: /a/})
+res = t.save({_id: /a/});
assert(res.hasWriteError(), "_id regex");
// Should not allow regex _id, even if not first
-res = t.save({a:2, _id: /a/})
+res = t.save({a:2, _id: /a/});
assert(res.hasWriteError(), "a _id regex");
// Should not allow array _id
-res = t.save({_id: [9]})
+res = t.save({_id: [9]});
assert(res.hasWriteError(), "_id array");
// This is fine since _id isn't a top level field
-res = t.save({a :{ _id: [9]}})
+res = t.save({a :{ _id: [9]}});
assert(!res.hasWriteError(), "embedded _id array");
// This is fine since _id isn't a top level field
-res = t.save({b:1, a :{ _id: [9]}})
+res = t.save({b:1, a :{ _id: [9]}});
assert(!res.hasWriteError(), "b embedded _id array");
diff --git a/jstests/core/updatea.js b/jstests/core/updatea.js
index bcf50892420..13d2dd0acfc 100644
--- a/jstests/core/updatea.js
+++ b/jstests/core/updatea.js
@@ -3,43 +3,43 @@ var res;
t = db.updatea;
t.drop();
-orig = { _id : 1 , a : [ { x : 1 , y : 2 } , { x : 10 , y : 11 } ] }
+orig = { _id : 1 , a : [ { x : 1 , y : 2 } , { x : 10 , y : 11 } ] };
-res = t.save( orig )
+res = t.save( orig );
assert.writeOK(res);
// SERVER-181
-res = t.update( {} , { $set : { "a.0.x" : 3 } } )
+res = t.update( {} , { $set : { "a.0.x" : 3 } } );
assert.writeOK(res);
orig.a[0].x = 3;
assert.eq( orig , t.findOne() , "A1" );
-res = t.update( {} , { $set : { "a.1.z" : 17 } } )
+res = t.update( {} , { $set : { "a.1.z" : 17 } } );
assert.writeOK(res);
orig.a[1].z = 17;
assert.eq( orig , t.findOne() , "A2" );
// SERVER-273
-res = t.update( {} , { $unset : { "a.1.y" : 1 } } )
+res = t.update( {} , { $unset : { "a.1.y" : 1 } } );
assert.writeOK(res);
-delete orig.a[1].y
+delete orig.a[1].y;
assert.eq( orig , t.findOne() , "A3" );
// SERVER-333
t.drop();
-orig = { _id : 1 , comments : [ { name : "blah" , rate_up : 0 , rate_ups : [] } ] }
+orig = { _id : 1 , comments : [ { name : "blah" , rate_up : 0 , rate_ups : [] } ] };
res = t.save( orig );
assert.writeOK(res);
-res = t.update( {} , { $inc: { "comments.0.rate_up" : 1 } , $push: { "comments.0.rate_ups" : 99 } } )
+res = t.update( {} , { $inc: { "comments.0.rate_up" : 1 } , $push: { "comments.0.rate_ups" : 99 } } );
assert.writeOK(res);
orig.comments[0].rate_up++;
-orig.comments[0].rate_ups.push( 99 )
-assert.eq( orig , t.findOne() , "B1" )
+orig.comments[0].rate_ups.push( 99 );
+assert.eq( orig , t.findOne() , "B1" );
t.drop();
-orig = { _id : 1 , a : [] }
+orig = { _id : 1 , a : [] };
for ( i=0; i<12; i++ )
orig.a.push( i );
@@ -59,10 +59,10 @@ orig.a[10]++;
// SERVER-3218
-t.drop()
-t.insert({"a":{"c00":1}, 'c':2})
-res = t.update({"c":2}, {'$inc':{'a.c000':1}})
+t.drop();
+t.insert({"a":{"c00":1}, 'c':2});
+res = t.update({"c":2}, {'$inc':{'a.c000':1}});
assert.writeOK(res);
-assert.eq( { "c00" : 1 , "c000" : 1 } , t.findOne().a , "D1" )
+assert.eq( { "c00" : 1 , "c000" : 1 } , t.findOne().a , "D1" );
diff --git a/jstests/core/updateb.js b/jstests/core/updateb.js
index d85e19a36bc..59e6348a47a 100644
--- a/jstests/core/updateb.js
+++ b/jstests/core/updateb.js
@@ -7,5 +7,5 @@ t.update( { "x.y" : 2 } , { $inc : { a : 7 } } , true );
correct = { a : 7 , x : { y : 2 } };
got = t.findOne();
delete got._id;
-assert.docEq( correct , got , "A" )
+assert.docEq( correct , got , "A" );
diff --git a/jstests/core/updated.js b/jstests/core/updated.js
index c202e8d435f..da314268eb0 100644
--- a/jstests/core/updated.js
+++ b/jstests/core/updated.js
@@ -1,6 +1,6 @@
t = db.updated;
-t.drop()
+t.drop();
o = { _id : Math.random() ,
items:[null,null,null,null]
diff --git a/jstests/core/updateh.js b/jstests/core/updateh.js
index 64cc30048e4..c409b49edaf 100644
--- a/jstests/core/updateh.js
+++ b/jstests/core/updateh.js
@@ -1,30 +1,30 @@
// Disallow $ in field names
var res;
-t = db.jstest_updateh
-t.drop()
+t = db.jstest_updateh;
+t.drop();
-t.insert( {x:1} )
+t.insert( {x:1} );
-res = t.update( {x:1}, {$set: {y:1}} ) // ok
-assert.writeOK( res )
+res = t.update( {x:1}, {$set: {y:1}} ); // ok
+assert.writeOK( res );
-res = t.update( {x:1}, {$set: {$z:1}} ) // not ok
-assert.writeError( res )
+res = t.update( {x:1}, {$set: {$z:1}} ); // not ok
+assert.writeError( res );
-res = t.update( {x:1}, {$set: {'a.$b':1}} ) // not ok
-assert.writeError( res )
+res = t.update( {x:1}, {$set: {'a.$b':1}} ); // not ok
+assert.writeError( res );
-res = t.update( {x:1}, {$inc: {$z:1}} ) // not ok
-assert.writeError( res )
+res = t.update( {x:1}, {$inc: {$z:1}} ); // not ok
+assert.writeError( res );
-res = t.update( {x:1}, {$pushAll: {$z:[1,2,3]}} ) // not ok
-assert.writeError( res )
+res = t.update( {x:1}, {$pushAll: {$z:[1,2,3]}} ); // not ok
+assert.writeError( res );
//Second section
-t.drop()
+t.drop();
-t.save( {_id:0, n: 0} )
+t.save( {_id:0, n: 0} );
// Test that '$' cannot be the first character in a field.
// SERVER-7150
@@ -45,7 +45,7 @@ assert.writeError(res);
res = t.update({ n: 0 }, { $set: { "secret.agent$": 1 }});
assert.writeOK(res);
-t.save( {_id:0, n: 0} )
+t.save( {_id:0, n: 0} );
// Test that you cannot update database references into top level fields
// Enable after SERVER-14252 fixed: currently validation does not catch DBRef
@@ -72,14 +72,14 @@ assert.writeError(res);
// SERVER-3231
res = t.update({ n: 0 }, { $set: { 'x.$ref': '1', 'x.$id': 1, 'x.$db': '1' }});
assert.writeOK(res);
-t.save( {_id:0, n: 0} )
+t.save( {_id:0, n: 0} );
// Test that '$' can occur elsewhere in a field name.
// SERVER-7557
res = t.update({n: 0 }, { $set: { ke$sha: 1 }});
assert.writeOK(res);
-t.save( {_id:0, n: 0} )
+t.save( {_id:0, n: 0} );
res = t.update({n: 0 }, { $set: { more$$moreproblem$: 1 }});
assert.writeOK(res);
-t.save( {_id:0, n: 0} )
+t.save( {_id:0, n: 0} );
diff --git a/jstests/core/updatem.js b/jstests/core/updatem.js
index 3d46d2a15f3..a636ac99a59 100644
--- a/jstests/core/updatem.js
+++ b/jstests/core/updatem.js
@@ -4,17 +4,17 @@ t = db.jstests_updatem;
t.drop();
// new _id from insert (upsert:true)
-t.update({a:1}, {$inc:{b:1}}, true)
+t.update({a:1}, {$inc:{b:1}}, true);
var doc = t.findOne({a:1});
-assert(doc["_id"], "missing _id")
+assert(doc["_id"], "missing _id");
// new _id from insert (upsert:true)
-t.update({a:1}, {$inc:{b:1}}, true)
+t.update({a:1}, {$inc:{b:1}}, true);
var doc = t.findOne({a:1});
-assert(doc["_id"], "missing _id")
+assert(doc["_id"], "missing _id");
// no _id on existing doc
-t.getDB().runCommand({godinsert:t.getName(), obj:{a:2}})
-t.update({a:2}, {$inc:{b:1}}, true)
+t.getDB().runCommand({godinsert:t.getName(), obj:{a:2}});
+t.update({a:2}, {$inc:{b:1}}, true);
var doc = t.findOne({a:2});
-assert(doc["_id"], "missing _id after update")
+assert(doc["_id"], "missing _id after update");
diff --git a/jstests/core/upsert_and.js b/jstests/core/upsert_and.js
index 7020837adf6..744c9a9331d 100644
--- a/jstests/core/upsert_and.js
+++ b/jstests/core/upsert_and.js
@@ -5,33 +5,33 @@ coll.drop();
res = coll.update({_id: 1, $and: [{c: 1}, {d: 1}], a: 12} , {$inc: {y: 1}} , true);
assert.writeOK(res);
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, a: 12, y: 1})
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, a: 12, y: 1});
-coll.remove({})
+coll.remove({});
res = coll.update({$and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
assert.writeOK(res);
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1});
-coll.remove({})
+coll.remove({});
res = coll.update({$and: [{c: 1}, {d: 1}, {$or: [{x:1}]}]} , {$setOnInsert: {_id: 1}} , true);
assert.writeOK(res);
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, x:1})
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, x:1});
-coll.remove({})
+coll.remove({});
res = coll.update({$and: [{c: 1}, {d: 1}], $or: [{x: 1}, {x: 2}]} , {$setOnInsert: {_id: 1}} , true);
-assert.writeOK(res);;
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1});
-coll.remove({})
+coll.remove({});
res = coll.update({r: {$gt: 3}, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
assert.writeOK(res);
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1});
-coll.remove({})
+coll.remove({});
res = coll.update({r: /s/, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
assert.writeOK(res);
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1});
-coll.remove({})
+coll.remove({});
res = coll.update({c:2, $and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
assert.writeError(res);
diff --git a/jstests/core/upsert_shell.js b/jstests/core/upsert_shell.js
index ab502f7ddb5..a4cf3f4b923 100644
--- a/jstests/core/upsert_shell.js
+++ b/jstests/core/upsert_shell.js
@@ -15,36 +15,36 @@ assert.eq( l.getUpsertedId()._id.str , t.findOne( { x : 2 } )._id.str , "B2" );
assert.eq( 2 , t.find().count() , "B3" );
// use the _id from the query for the insert
-l = t.update({_id:3}, {$set: {a:'123'}}, true)
+l = t.update({_id:3}, {$set: {a:'123'}}, true);
assert( l.getUpsertedId() , "C1 - " + tojson(l) );
assert.eq( l.getUpsertedId()._id , 3 , "C2 - " + tojson(l) );
// test with an embedded doc for the _id field
-l = t.update({_id:{a:1}}, {$set: {a:123}}, true)
+l = t.update({_id:{a:1}}, {$set: {a:123}}, true);
assert( l.getUpsertedId() , "D1 - " + tojson(l) );
assert.eq( l.getUpsertedId()._id , {a:1} , "D2 - " + tojson(l) );
// test with a range query
-l = t.update({_id: {$gt:100}}, {$set: {a:123}}, true)
+l = t.update({_id: {$gt:100}}, {$set: {a:123}}, true);
assert( l.getUpsertedId() , "E1 - " + tojson(l) );
assert.neq( l.getUpsertedId()._id , 100 , "E2 - " + tojson(l) );
// test with an _id query
-l = t.update({_id: 1233}, {$set: {a:123}}, true)
+l = t.update({_id: 1233}, {$set: {a:123}}, true);
assert( l.getUpsertedId() , "F1 - " + tojson(l) );
assert.eq( l.getUpsertedId()._id , 1233 , "F2 - " + tojson(l) );
// test with an embedded _id query
-l = t.update({_id: {a:1, b:2}}, {$set: {a:123}}, true)
+l = t.update({_id: {a:1, b:2}}, {$set: {a:123}}, true);
assert( l.getUpsertedId() , "G1 - " + tojson(l) );
assert.eq( l.getUpsertedId()._id , {a:1, b:2} , "G2 - " + tojson(l) );
// test with no _id inserted
db.no_id.drop();
-db.createCollection("no_id", {autoIndexId:false})
-l = db.no_id.update({foo:1}, {$set:{a:1}}, true)
+db.createCollection("no_id", {autoIndexId:false});
+l = db.no_id.update({foo:1}, {$set:{a:1}}, true);
assert( l.getUpsertedId() , "H1 - " + tojson(l) );
-assert( !l.hasWriteError(), "H1.5 No error expected - " + tojson(l) )
+assert( !l.hasWriteError(), "H1.5 No error expected - " + tojson(l) );
assert.eq( 0, db.no_id.getIndexes().length, "H2" );
assert.eq( 1, db.no_id.count(), "H3" );
var newDoc = db.no_id.findOne();
diff --git a/jstests/core/useindexonobjgtlt.js b/jstests/core/useindexonobjgtlt.js
index e407ad7cf0a..026b1802843 100755
--- a/jstests/core/useindexonobjgtlt.js
+++ b/jstests/core/useindexonobjgtlt.js
@@ -1,14 +1,14 @@
-t = db.factories
-t.drop()
-t.insert( { name: "xyz", metro: { city: "New York", state: "NY" } } )
-t.ensureIndex( { metro : 1 } )
+t = db.factories;
+t.drop();
+t.insert( { name: "xyz", metro: { city: "New York", state: "NY" } } );
+t.ensureIndex( { metro : 1 } );
-assert( db.factories.find().count() )
+assert( db.factories.find().count() );
assert.eq( 1, db.factories.find( { metro: { city: "New York", state: "NY" } } )
.hint({metro: 1})
- .count() )
+ .count() );
assert.eq( 1, db.factories.find( { metro: { $gte : { city: "New York" } } } )
.hint({metro: 1})
- .count() )
+ .count() );
diff --git a/jstests/core/user_management_helpers.js b/jstests/core/user_management_helpers.js
index 43346c848f1..e06302deba5 100644
--- a/jstests/core/user_management_helpers.js
+++ b/jstests/core/user_management_helpers.js
@@ -68,7 +68,7 @@ function runTest(db) {
assert.eq(null, db.getUser('andy'));
// Test dropAllUsers
- db.dropAllUsers()
+ db.dropAllUsers();
assert.eq(0, db.getUsers().length);
// Test password digestion
@@ -91,7 +91,7 @@ function runTest(db) {
assert(db.auth('user1', 'y'));
assert(db.auth('user2', 'y'));
-};
+}
try {
runTest(db);
diff --git a/jstests/core/verify_update_mods.js b/jstests/core/verify_update_mods.js
index d7a80061e6e..7806b7804d3 100644
--- a/jstests/core/verify_update_mods.js
+++ b/jstests/core/verify_update_mods.js
@@ -4,59 +4,59 @@ t = db.update_mods;
t.drop();
t.save({_id:1});
-res = t.update({}, {$set:{a:1}})
+res = t.update({}, {$set:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$unset:{a:1}})
+res = t.update({}, {$unset:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$inc:{a:1}})
+res = t.update({}, {$inc:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$mul:{a:1}})
+res = t.update({}, {$mul:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$push:{a:1}})
+res = t.update({}, {$push:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$pushAll:{a:[1]}})
+res = t.update({}, {$pushAll:{a:[1]}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$addToSet:{a:1}})
+res = t.update({}, {$addToSet:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$pull:{a:1}})
+res = t.update({}, {$pull:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$pop:{a:true}})
+res = t.update({}, {$pop:{a:true}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$rename:{a:"b"}})
+res = t.update({}, {$rename:{a:"b"}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$bit:{a:{and:NumberLong(1)}}})
+res = t.update({}, {$bit:{a:{and:NumberLong(1)}}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
// SERVER-3223 test $bit can do an upsert
t.update({_id:1}, {$bit:{a:{and:NumberLong(3)}}}, true);
@@ -68,16 +68,16 @@ assert.eq(t.findOne({_id:3}).c.d, NumberInt(3), "$bit upsert with or (int)");
t.remove({});
t.save({_id:1});
-res = t.update({}, {$currentDate:{a:true}})
+res = t.update({}, {$currentDate:{a:true}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$max:{a:1}})
+res = t.update({}, {$max:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
t.save({_id:1});
-res = t.update({}, {$min:{a:1}})
+res = t.update({}, {$min:{a:1}});
assert.writeOK(res);
-t.remove({})
+t.remove({});
diff --git a/jstests/core/where3.js b/jstests/core/where3.js
index fdb8bf298d3..2eb53f82370 100644
--- a/jstests/core/where3.js
+++ b/jstests/core/where3.js
@@ -1,6 +1,6 @@
t = db.where3;
-t.drop()
+t.drop();
t.save( { returned_date : 5 } );
t.save( { returned_date : 6 } );
diff --git a/jstests/core/where4.js b/jstests/core/where4.js
index 61ec3771bed..685665c982a 100644
--- a/jstests/core/where4.js
+++ b/jstests/core/where4.js
@@ -1,27 +1,27 @@
db.where4.drop();
-db.system.js.insert( { _id : "w4" , value : "5" } )
+db.system.js.insert( { _id : "w4" , value : "5" } );
-db.where4.insert( { x : 1 , y : 1 } )
-db.where4.insert( { x : 2 , y : 1 } )
+db.where4.insert( { x : 1 , y : 1 } );
+db.where4.insert( { x : 2 , y : 1 } );
db.where4.update( { $where : function() { return this.x == 1; } } ,
{ $inc : { y : 1 } } , false , true );
-assert.eq( 2 , db.where4.findOne( { x : 1 } ).y )
-assert.eq( 1 , db.where4.findOne( { x : 2 } ).y )
+assert.eq( 2 , db.where4.findOne( { x : 1 } ).y );
+assert.eq( 1 , db.where4.findOne( { x : 2 } ).y );
// Test that where queries work with stored javascript
-db.system.js.save( { _id : "where4_addOne" , value : function(x) { return x + 1; } } )
+db.system.js.save( { _id : "where4_addOne" , value : function(x) { return x + 1; } } );
db.where4.update( { $where : "where4_addOne(this.x) == 2" } ,
{ $inc : { y : 1 } } , false , true );
-assert.eq( 3 , db.where4.findOne( { x : 1 } ).y )
-assert.eq( 1 , db.where4.findOne( { x : 2 } ).y )
+assert.eq( 3 , db.where4.findOne( { x : 1 } ).y );
+assert.eq( 1 , db.where4.findOne( { x : 2 } ).y );
-db.system.js.remove( { _id : "where4_equalsOne" } )
+db.system.js.remove( { _id : "where4_equalsOne" } );
-db.system.js.remove( { _id : "w4" } )
+db.system.js.remove( { _id : "w4" } );
diff --git a/jstests/core/write_result.js b/jstests/core/write_result.js
index 95c298c165a..8cf505f688e 100644
--- a/jstests/core/write_result.js
+++ b/jstests/core/write_result.js
@@ -5,7 +5,7 @@
var coll = db.write_result;
coll.drop();
-assert(coll.getDB().getMongo().useWriteCommands(), "test is not running with write commands")
+assert(coll.getDB().getMongo().useWriteCommands(), "test is not running with write commands");
var result = null;