summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-01-14 14:09:42 -0500
committerRandolph Tan <randolph@10gen.com>2014-02-28 16:26:33 -0500
commit5595b945603b0712c537787e31e6da661c424fee (patch)
tree90945ee3fe4931032f3af2d397bb755fbf5d30ef /jstests
parentcd62080dcb036e83f8fca6d68d9bcab67bf7a21c (diff)
downloadmongo-5595b945603b0712c537787e31e6da661c424fee.tar.gz
SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
Diffstat (limited to 'jstests')
-rw-r--r--jstests/basicb.js7
-rw-r--r--jstests/core/all.js (renamed from jstests/all.js)0
-rw-r--r--jstests/core/all2.js (renamed from jstests/all2.js)0
-rw-r--r--jstests/core/all3.js (renamed from jstests/all3.js)0
-rw-r--r--jstests/core/all4.js (renamed from jstests/all4.js)2
-rw-r--r--jstests/core/all5.js (renamed from jstests/all5.js)0
-rw-r--r--jstests/core/and.js (renamed from jstests/and.js)0
-rw-r--r--jstests/core/and2.js (renamed from jstests/and2.js)0
-rw-r--r--jstests/core/and3.js (renamed from jstests/and3.js)0
-rw-r--r--jstests/core/andor.js (renamed from jstests/andor.js)0
-rw-r--r--jstests/core/apitest_db.js (renamed from jstests/apitest_db.js)0
-rw-r--r--jstests/core/apitest_dbcollection.js (renamed from jstests/apitest_dbcollection.js)0
-rw-r--r--jstests/core/apply_ops1.js (renamed from jstests/apply_ops1.js)0
-rw-r--r--jstests/core/apply_ops2.js (renamed from jstests/apply_ops2.js)0
-rw-r--r--jstests/core/array1.js (renamed from jstests/array1.js)0
-rw-r--r--jstests/core/array3.js (renamed from jstests/array3.js)0
-rw-r--r--jstests/core/array4.js (renamed from jstests/array4.js)0
-rw-r--r--jstests/core/array_match1.js (renamed from jstests/array_match1.js)0
-rw-r--r--jstests/core/array_match2.js (renamed from jstests/array_match2.js)0
-rw-r--r--jstests/core/array_match3.js (renamed from jstests/array_match3.js)0
-rw-r--r--jstests/core/array_match4.js (renamed from jstests/array_match4.js)0
-rw-r--r--jstests/core/arrayfind1.js (renamed from jstests/arrayfind1.js)0
-rw-r--r--jstests/core/arrayfind2.js (renamed from jstests/arrayfind2.js)0
-rw-r--r--jstests/core/arrayfind3.js (renamed from jstests/arrayfind3.js)0
-rw-r--r--jstests/core/arrayfind4.js (renamed from jstests/arrayfind4.js)0
-rw-r--r--jstests/core/arrayfind5.js (renamed from jstests/arrayfind5.js)0
-rw-r--r--jstests/core/arrayfind6.js (renamed from jstests/arrayfind6.js)0
-rw-r--r--jstests/core/arrayfind7.js (renamed from jstests/arrayfind7.js)0
-rw-r--r--jstests/core/arrayfind8.js (renamed from jstests/arrayfind8.js)0
-rw-r--r--jstests/core/arrayfind9.js (renamed from jstests/arrayfind9.js)0
-rw-r--r--jstests/core/arrayfinda.js (renamed from jstests/arrayfinda.js)0
-rw-r--r--jstests/core/auth1.js (renamed from jstests/auth1.js)0
-rw-r--r--jstests/core/auth2.js (renamed from jstests/auth2.js)0
-rw-r--r--jstests/core/auth_copydb.js (renamed from jstests/auth_copydb.js)0
-rw-r--r--jstests/core/autoid.js (renamed from jstests/autoid.js)0
-rw-r--r--jstests/core/bad_index_plugin.js (renamed from jstests/bad_index_plugin.js)8
-rw-r--r--jstests/core/basic1.js (renamed from jstests/basic1.js)0
-rw-r--r--jstests/core/basic2.js (renamed from jstests/basic2.js)0
-rw-r--r--jstests/core/basic3.js (renamed from jstests/basic3.js)8
-rw-r--r--jstests/core/basic4.js (renamed from jstests/basic4.js)0
-rw-r--r--jstests/core/basic5.js (renamed from jstests/basic5.js)0
-rw-r--r--jstests/core/basic6.js (renamed from jstests/basic6.js)0
-rw-r--r--jstests/core/basic7.js (renamed from jstests/basic7.js)0
-rw-r--r--jstests/core/basic8.js (renamed from jstests/basic8.js)0
-rw-r--r--jstests/core/basic9.js (renamed from jstests/basic9.js)4
-rw-r--r--jstests/core/basica.js (renamed from jstests/basica.js)0
-rw-r--r--jstests/core/basicb.js6
-rw-r--r--jstests/core/basicc.js (renamed from jstests/basicc.js)6
-rw-r--r--jstests/core/batch_size.js (renamed from jstests/batch_size.js)0
-rw-r--r--jstests/core/bench_test1.js (renamed from jstests/bench_test1.js)0
-rw-r--r--jstests/core/bench_test2.js (renamed from jstests/bench_test2.js)1
-rw-r--r--jstests/core/bench_test3.js (renamed from jstests/bench_test3.js)0
-rw-r--r--jstests/core/big_object1.js (renamed from jstests/big_object1.js)5
-rw-r--r--jstests/core/binData.js (renamed from jstests/binData.js)0
-rw-r--r--jstests/core/block_check_supported.js (renamed from jstests/block_check_supported.js)0
-rw-r--r--jstests/core/bulk_insert.js (renamed from jstests/bulk_insert.js)0
-rw-r--r--jstests/core/capped.js (renamed from jstests/capped.js)0
-rw-r--r--jstests/core/capped1.js (renamed from jstests/capped1.js)0
-rw-r--r--jstests/core/capped2.js (renamed from jstests/capped2.js)0
-rw-r--r--jstests/core/capped3.js (renamed from jstests/capped3.js)0
-rw-r--r--jstests/core/capped5.js (renamed from jstests/capped5.js)0
-rw-r--r--jstests/core/capped6.js (renamed from jstests/capped6.js)0
-rw-r--r--jstests/core/capped7.js (renamed from jstests/capped7.js)0
-rw-r--r--jstests/core/capped8.js (renamed from jstests/capped8.js)0
-rw-r--r--jstests/core/capped9.js (renamed from jstests/capped9.js)3
-rw-r--r--jstests/core/capped_empty.js (renamed from jstests/capped_empty.js)0
-rw-r--r--jstests/core/capped_max.js (renamed from jstests/capped_max.js)0
-rw-r--r--jstests/core/capped_server2639.js (renamed from jstests/capped_server2639.js)6
-rw-r--r--jstests/core/capped_server7543.js (renamed from jstests/capped_server7543.js)0
-rw-r--r--jstests/core/cappeda.js (renamed from jstests/cappeda.js)7
-rw-r--r--jstests/core/check_shard_index.js (renamed from jstests/check_shard_index.js)0
-rw-r--r--jstests/core/collmod.js (renamed from jstests/collmod.js)0
-rw-r--r--jstests/core/compact.js (renamed from jstests/compact.js)0
-rw-r--r--jstests/core/compact2.js (renamed from jstests/compact2.js)0
-rw-r--r--jstests/core/compactPreservePadding.js (renamed from jstests/compactPreservePadding.js)0
-rw-r--r--jstests/core/connection_status.js (renamed from jstests/connection_status.js)0
-rw-r--r--jstests/core/connection_string_validation.js (renamed from jstests/connection_string_validation.js)0
-rw-r--r--jstests/core/constructors.js (renamed from jstests/constructors.js)3
-rw-r--r--jstests/core/copydb.js (renamed from jstests/copydb.js)0
-rw-r--r--jstests/core/count.js (renamed from jstests/count.js)0
-rw-r--r--jstests/core/count10.js (renamed from jstests/count10.js)2
-rw-r--r--jstests/core/count2.js (renamed from jstests/count2.js)0
-rw-r--r--jstests/core/count3.js (renamed from jstests/count3.js)0
-rw-r--r--jstests/core/count4.js (renamed from jstests/count4.js)0
-rw-r--r--jstests/core/count5.js (renamed from jstests/count5.js)0
-rw-r--r--jstests/core/count6.js (renamed from jstests/count6.js)0
-rw-r--r--jstests/core/count7.js (renamed from jstests/count7.js)0
-rw-r--r--jstests/core/count9.js (renamed from jstests/count9.js)0
-rw-r--r--jstests/core/count_hint.js (renamed from jstests/count_hint.js)0
-rw-r--r--jstests/core/counta.js (renamed from jstests/counta.js)0
-rw-r--r--jstests/core/countb.js (renamed from jstests/countb.js)0
-rw-r--r--jstests/core/countc.js (renamed from jstests/countc.js)0
-rw-r--r--jstests/core/coveredIndex1.js (renamed from jstests/coveredIndex1.js)0
-rw-r--r--jstests/core/coveredIndex2.js (renamed from jstests/coveredIndex2.js)0
-rw-r--r--jstests/core/coveredIndex3.js (renamed from jstests/coveredIndex3.js)0
-rw-r--r--jstests/core/coveredIndex4.js (renamed from jstests/coveredIndex4.js)0
-rw-r--r--jstests/core/coveredIndex5.js (renamed from jstests/coveredIndex5.js)0
-rw-r--r--jstests/core/covered_index_compound_1.js (renamed from jstests/covered_index_compound_1.js)0
-rw-r--r--jstests/core/covered_index_geo_1.js (renamed from jstests/covered_index_geo_1.js)0
-rw-r--r--jstests/core/covered_index_geo_2.js (renamed from jstests/covered_index_geo_2.js)0
-rw-r--r--jstests/core/covered_index_negative_1.js (renamed from jstests/covered_index_negative_1.js)0
-rw-r--r--jstests/core/covered_index_simple_1.js (renamed from jstests/covered_index_simple_1.js)0
-rw-r--r--jstests/core/covered_index_simple_2.js (renamed from jstests/covered_index_simple_2.js)0
-rw-r--r--jstests/core/covered_index_simple_3.js (renamed from jstests/covered_index_simple_3.js)0
-rw-r--r--jstests/core/covered_index_simple_id.js (renamed from jstests/covered_index_simple_id.js)0
-rw-r--r--jstests/core/covered_index_sort_1.js (renamed from jstests/covered_index_sort_1.js)0
-rw-r--r--jstests/core/covered_index_sort_2.js (renamed from jstests/covered_index_sort_2.js)0
-rw-r--r--jstests/core/covered_index_sort_3.js (renamed from jstests/covered_index_sort_3.js)0
-rw-r--r--jstests/core/create_indexes.js (renamed from jstests/create_indexes.js)37
-rw-r--r--jstests/core/currentop.js (renamed from jstests/currentop.js)5
-rw-r--r--jstests/core/cursor1.js (renamed from jstests/cursor1.js)0
-rw-r--r--jstests/core/cursor2.js (renamed from jstests/cursor2.js)0
-rw-r--r--jstests/core/cursor3.js (renamed from jstests/cursor3.js)0
-rw-r--r--jstests/core/cursor4.js (renamed from jstests/cursor4.js)0
-rw-r--r--jstests/core/cursor5.js (renamed from jstests/cursor5.js)0
-rw-r--r--jstests/core/cursor6.js (renamed from jstests/cursor6.js)0
-rw-r--r--jstests/core/cursor7.js (renamed from jstests/cursor7.js)0
-rw-r--r--jstests/core/cursora.js (renamed from jstests/cursora.js)10
-rw-r--r--jstests/core/cursorb.js (renamed from jstests/cursorb.js)0
-rw-r--r--jstests/core/datasize.js (renamed from jstests/datasize.js)0
-rw-r--r--jstests/core/datasize2.js (renamed from jstests/datasize2.js)0
-rw-r--r--jstests/core/datasize3.js (renamed from jstests/datasize3.js)0
-rw-r--r--jstests/core/date1.js (renamed from jstests/date1.js)0
-rw-r--r--jstests/core/date2.js (renamed from jstests/date2.js)0
-rw-r--r--jstests/core/date3.js (renamed from jstests/date3.js)0
-rw-r--r--jstests/core/db.js (renamed from jstests/db.js)0
-rw-r--r--jstests/core/dbadmin.js (renamed from jstests/dbadmin.js)0
-rw-r--r--jstests/core/dbcase.js (renamed from jstests/dbcase.js)10
-rw-r--r--jstests/core/dbcase2.js (renamed from jstests/dbcase2.js)0
-rw-r--r--jstests/core/dbhash.js (renamed from jstests/dbhash.js)0
-rw-r--r--jstests/core/dbhash2.js (renamed from jstests/dbhash2.js)0
-rw-r--r--jstests/core/dbref1.js (renamed from jstests/dbref1.js)0
-rw-r--r--jstests/core/dbref2.js (renamed from jstests/dbref2.js)0
-rw-r--r--jstests/core/dbref3.js (renamed from jstests/dbref3.js)0
-rw-r--r--jstests/core/delx.js (renamed from jstests/delx.js)2
-rw-r--r--jstests/core/depth_limit.js (renamed from jstests/depth_limit.js)0
-rw-r--r--jstests/core/distinct1.js (renamed from jstests/distinct1.js)0
-rw-r--r--jstests/core/distinct2.js (renamed from jstests/distinct2.js)0
-rw-r--r--jstests/core/distinct3.js (renamed from jstests/distinct3.js)24
-rw-r--r--jstests/core/distinct_array1.js (renamed from jstests/distinct_array1.js)0
-rw-r--r--jstests/core/distinct_index1.js (renamed from jstests/distinct_index1.js)0
-rw-r--r--jstests/core/distinct_index2.js (renamed from jstests/distinct_index2.js)0
-rw-r--r--jstests/core/distinct_speed1.js (renamed from jstests/distinct_speed1.js)0
-rw-r--r--jstests/core/drop.js (renamed from jstests/drop.js)0
-rw-r--r--jstests/core/drop2.js (renamed from jstests/drop2.js)1
-rw-r--r--jstests/core/drop3.js (renamed from jstests/drop3.js)4
-rw-r--r--jstests/core/drop_index.js (renamed from jstests/drop_index.js)0
-rw-r--r--jstests/core/dropdb.js (renamed from jstests/dropdb.js)1
-rw-r--r--jstests/core/dropdb_race.js (renamed from jstests/dropdb_race.js)7
-rw-r--r--jstests/core/elemMatchProjection.js (renamed from jstests/elemMatchProjection.js)0
-rw-r--r--jstests/core/error2.js (renamed from jstests/error2.js)0
-rw-r--r--jstests/core/error5.js (renamed from jstests/error5.js)0
-rw-r--r--jstests/core/eval0.js (renamed from jstests/eval0.js)0
-rw-r--r--jstests/core/eval1.js (renamed from jstests/eval1.js)0
-rw-r--r--jstests/core/eval2.js (renamed from jstests/eval2.js)0
-rw-r--r--jstests/core/eval3.js (renamed from jstests/eval3.js)0
-rw-r--r--jstests/core/eval4.js (renamed from jstests/eval4.js)0
-rw-r--r--jstests/core/eval5.js (renamed from jstests/eval5.js)0
-rw-r--r--jstests/core/eval6.js (renamed from jstests/eval6.js)0
-rw-r--r--jstests/core/eval7.js (renamed from jstests/eval7.js)0
-rw-r--r--jstests/core/eval8.js (renamed from jstests/eval8.js)0
-rw-r--r--jstests/core/eval9.js (renamed from jstests/eval9.js)0
-rw-r--r--jstests/core/eval_nolock.js (renamed from jstests/eval_nolock.js)0
-rw-r--r--jstests/core/evala.js (renamed from jstests/evala.js)0
-rw-r--r--jstests/core/evalb.js (renamed from jstests/evalb.js)0
-rw-r--r--jstests/core/evalc.js (renamed from jstests/evalc.js)0
-rw-r--r--jstests/core/evald.js (renamed from jstests/evald.js)1
-rw-r--r--jstests/core/evale.js (renamed from jstests/evale.js)0
-rw-r--r--jstests/core/evalf.js (renamed from jstests/evalf.js)0
-rw-r--r--jstests/core/exists.js (renamed from jstests/exists.js)0
-rw-r--r--jstests/core/exists2.js (renamed from jstests/exists2.js)0
-rw-r--r--jstests/core/exists3.js (renamed from jstests/exists3.js)0
-rw-r--r--jstests/core/exists4.js (renamed from jstests/exists4.js)0
-rw-r--r--jstests/core/exists5.js (renamed from jstests/exists5.js)0
-rw-r--r--jstests/core/exists6.js (renamed from jstests/exists6.js)0
-rw-r--r--jstests/core/exists7.js (renamed from jstests/exists7.js)0
-rw-r--r--jstests/core/exists8.js (renamed from jstests/exists8.js)0
-rw-r--r--jstests/core/exists9.js (renamed from jstests/exists9.js)0
-rw-r--r--jstests/core/existsa.js (renamed from jstests/existsa.js)0
-rw-r--r--jstests/core/existsb.js (renamed from jstests/existsb.js)0
-rw-r--r--jstests/core/explain1.js (renamed from jstests/explain1.js)0
-rw-r--r--jstests/core/explain2.js (renamed from jstests/explain2.js)0
-rw-r--r--jstests/core/explain3.js (renamed from jstests/explain3.js)3
-rw-r--r--jstests/core/explain4.js (renamed from jstests/explain4.js)0
-rw-r--r--jstests/core/explain5.js (renamed from jstests/explain5.js)0
-rw-r--r--jstests/core/explain6.js (renamed from jstests/explain6.js)0
-rw-r--r--jstests/core/explain7.js (renamed from jstests/explain7.js)0
-rw-r--r--jstests/core/explain8.js (renamed from jstests/explain8.js)0
-rw-r--r--jstests/core/explain9.js (renamed from jstests/explain9.js)0
-rw-r--r--jstests/core/explain_batch_size.js (renamed from jstests/explain_batch_size.js)0
-rw-r--r--jstests/core/explaina.js (renamed from jstests/explaina.js)0
-rw-r--r--jstests/core/explainb.js (renamed from jstests/explainb.js)0
-rw-r--r--jstests/core/extent.js (renamed from jstests/extent.js)0
-rw-r--r--jstests/core/extent2.js (renamed from jstests/extent2.js)0
-rw-r--r--jstests/core/filemd5.js (renamed from jstests/filemd5.js)0
-rw-r--r--jstests/core/find1.js (renamed from jstests/find1.js)0
-rw-r--r--jstests/core/find2.js (renamed from jstests/find2.js)0
-rw-r--r--jstests/core/find3.js (renamed from jstests/find3.js)0
-rw-r--r--jstests/core/find4.js (renamed from jstests/find4.js)0
-rw-r--r--jstests/core/find5.js (renamed from jstests/find5.js)0
-rw-r--r--jstests/core/find6.js (renamed from jstests/find6.js)0
-rw-r--r--jstests/core/find7.js (renamed from jstests/find7.js)0
-rw-r--r--jstests/core/find8.js (renamed from jstests/find8.js)0
-rw-r--r--jstests/core/find9.js (renamed from jstests/find9.js)0
-rw-r--r--jstests/core/find_and_modify.js (renamed from jstests/find_and_modify.js)0
-rw-r--r--jstests/core/find_and_modify2.js (renamed from jstests/find_and_modify2.js)0
-rw-r--r--jstests/core/find_and_modify3.js (renamed from jstests/find_and_modify3.js)0
-rw-r--r--jstests/core/find_and_modify4.js (renamed from jstests/find_and_modify4.js)0
-rw-r--r--jstests/core/find_and_modify_server6226.js (renamed from jstests/find_and_modify_server6226.js)0
-rw-r--r--jstests/core/find_and_modify_server6254.js (renamed from jstests/find_and_modify_server6254.js)0
-rw-r--r--jstests/core/find_and_modify_server6582.js (renamed from jstests/find_and_modify_server6582.js)0
-rw-r--r--jstests/core/find_and_modify_server6588.js (renamed from jstests/find_and_modify_server6588.js)0
-rw-r--r--jstests/core/find_and_modify_server6659.js (renamed from jstests/find_and_modify_server6659.js)0
-rw-r--r--jstests/core/find_and_modify_server6909.js (renamed from jstests/find_and_modify_server6909.js)0
-rw-r--r--jstests/core/find_and_modify_server6993.js (renamed from jstests/find_and_modify_server6993.js)0
-rw-r--r--jstests/core/find_and_modify_server7660.js (renamed from jstests/find_and_modify_server7660.js)0
-rw-r--r--jstests/core/find_and_modify_where.js (renamed from jstests/find_and_modify_where.js)0
-rw-r--r--jstests/core/find_dedup.js (renamed from jstests/find_dedup.js)0
-rw-r--r--jstests/core/find_size.js (renamed from jstests/find_size.js)0
-rw-r--r--jstests/core/finda.js (renamed from jstests/finda.js)0
-rw-r--r--jstests/core/fm1.js (renamed from jstests/fm1.js)0
-rw-r--r--jstests/core/fm2.js (renamed from jstests/fm2.js)0
-rw-r--r--jstests/core/fm3.js (renamed from jstests/fm3.js)0
-rw-r--r--jstests/core/fm4.js (renamed from jstests/fm4.js)0
-rw-r--r--jstests/core/fsync.js (renamed from jstests/fsync.js)1
-rw-r--r--jstests/core/fts1.js (renamed from jstests/fts1.js)0
-rw-r--r--jstests/core/fts2.js (renamed from jstests/fts2.js)0
-rw-r--r--jstests/core/fts3.js (renamed from jstests/fts3.js)0
-rw-r--r--jstests/core/fts4.js (renamed from jstests/fts4.js)0
-rw-r--r--jstests/core/fts5.js (renamed from jstests/fts5.js)0
-rw-r--r--jstests/core/fts_blog.js (renamed from jstests/fts_blog.js)0
-rw-r--r--jstests/core/fts_blogwild.js (renamed from jstests/fts_blogwild.js)0
-rw-r--r--jstests/core/fts_enabled.js (renamed from jstests/fts_enabled.js)0
-rw-r--r--jstests/core/fts_explain.js (renamed from jstests/fts_explain.js)0
-rw-r--r--jstests/core/fts_index.js (renamed from jstests/fts_index.js)82
-rw-r--r--jstests/core/fts_mix.js (renamed from jstests/fts_mix.js)0
-rw-r--r--jstests/core/fts_partition1.js (renamed from jstests/fts_partition1.js)0
-rw-r--r--jstests/core/fts_partition_no_multikey.js13
-rw-r--r--jstests/core/fts_phrase.js (renamed from jstests/fts_phrase.js)0
-rw-r--r--jstests/core/fts_proj.js (renamed from jstests/fts_proj.js)0
-rw-r--r--jstests/core/fts_projection.js (renamed from jstests/fts_projection.js)0
-rw-r--r--jstests/core/fts_querylang.js (renamed from jstests/fts_querylang.js)0
-rw-r--r--jstests/core/fts_score_sort.js (renamed from jstests/fts_score_sort.js)0
-rw-r--r--jstests/core/fts_spanish.js (renamed from jstests/fts_spanish.js)7
-rw-r--r--jstests/core/geo1.js (renamed from jstests/geo1.js)10
-rw-r--r--jstests/core/geo10.js15
-rw-r--r--jstests/core/geo2.js (renamed from jstests/geo2.js)0
-rw-r--r--jstests/core/geo3.js (renamed from jstests/geo3.js)0
-rw-r--r--jstests/core/geo4.js11
-rw-r--r--jstests/core/geo5.js (renamed from jstests/geo5.js)0
-rw-r--r--jstests/core/geo6.js (renamed from jstests/geo6.js)0
-rw-r--r--jstests/core/geo7.js (renamed from jstests/geo7.js)0
-rw-r--r--jstests/core/geo8.js (renamed from jstests/geo8.js)0
-rw-r--r--jstests/core/geo9.js (renamed from jstests/geo9.js)0
-rw-r--r--jstests/core/geo_2d_explain.js (renamed from jstests/geo_2d_explain.js)0
-rw-r--r--jstests/core/geo_2d_with_geojson_point.js (renamed from jstests/geo_2d_with_geojson_point.js)0
-rw-r--r--jstests/core/geo_allowedcomparisons.js (renamed from jstests/geo_allowedcomparisons.js)36
-rw-r--r--jstests/core/geo_array0.js (renamed from jstests/geo_array0.js)11
-rw-r--r--jstests/core/geo_array1.js (renamed from jstests/geo_array1.js)0
-rw-r--r--jstests/core/geo_array2.js (renamed from jstests/geo_array2.js)4
-rw-r--r--jstests/core/geo_borders.js (renamed from jstests/geo_borders.js)22
-rw-r--r--jstests/core/geo_box1.js (renamed from jstests/geo_box1.js)0
-rw-r--r--jstests/core/geo_box1_noindex.js (renamed from jstests/geo_box1_noindex.js)0
-rw-r--r--jstests/core/geo_box2.js (renamed from jstests/geo_box2.js)0
-rw-r--r--jstests/core/geo_box3.js (renamed from jstests/geo_box3.js)0
-rw-r--r--jstests/core/geo_center_sphere1.js (renamed from jstests/geo_center_sphere1.js)6
-rw-r--r--jstests/core/geo_center_sphere2.js160
-rw-r--r--jstests/core/geo_circle1.js (renamed from jstests/geo_circle1.js)0
-rw-r--r--jstests/core/geo_circle1_noindex.js (renamed from jstests/geo_circle1_noindex.js)0
-rw-r--r--jstests/core/geo_circle2.js (renamed from jstests/geo_circle2.js)0
-rw-r--r--jstests/core/geo_circle2a.js (renamed from jstests/geo_circle2a.js)0
-rw-r--r--jstests/core/geo_circle3.js (renamed from jstests/geo_circle3.js)0
-rw-r--r--jstests/core/geo_circle4.js (renamed from jstests/geo_circle4.js)0
-rw-r--r--jstests/core/geo_circle5.js (renamed from jstests/geo_circle5.js)0
-rw-r--r--jstests/core/geo_distinct.js (renamed from jstests/geo_distinct.js)6
-rw-r--r--jstests/core/geo_exactfetch.js (renamed from jstests/geo_exactfetch.js)0
-rw-r--r--jstests/core/geo_fiddly_box.js (renamed from jstests/geo_fiddly_box.js)0
-rw-r--r--jstests/core/geo_fiddly_box2.js (renamed from jstests/geo_fiddly_box2.js)0
-rw-r--r--jstests/core/geo_group.js (renamed from jstests/geo_group.js)4
-rw-r--r--jstests/core/geo_haystack1.js (renamed from jstests/geo_haystack1.js)0
-rw-r--r--jstests/core/geo_haystack2.js (renamed from jstests/geo_haystack2.js)0
-rw-r--r--jstests/core/geo_haystack3.js (renamed from jstests/geo_haystack3.js)0
-rw-r--r--jstests/core/geo_invalid_polygon.js (renamed from jstests/geo_invalid_polygon.js)10
-rw-r--r--jstests/core/geo_mapreduce.js (renamed from jstests/geo_mapreduce.js)0
-rw-r--r--jstests/core/geo_mapreduce2.js (renamed from jstests/geo_mapreduce2.js)0
-rw-r--r--jstests/core/geo_max.js (renamed from jstests/geo_max.js)0
-rw-r--r--jstests/core/geo_mindistance.js (renamed from jstests/geo_mindistance.js)0
-rw-r--r--jstests/core/geo_mindistance_boundaries.js (renamed from jstests/geo_mindistance_boundaries.js)0
-rw-r--r--jstests/core/geo_multikey0.js (renamed from jstests/geo_multikey0.js)0
-rw-r--r--jstests/core/geo_multikey1.js (renamed from jstests/geo_multikey1.js)7
-rw-r--r--jstests/core/geo_multinest0.js (renamed from jstests/geo_multinest0.js)29
-rw-r--r--jstests/core/geo_multinest1.js (renamed from jstests/geo_multinest1.js)15
-rw-r--r--jstests/core/geo_near_random1.js (renamed from jstests/geo_near_random1.js)0
-rw-r--r--jstests/core/geo_near_random2.js (renamed from jstests/geo_near_random2.js)0
-rw-r--r--jstests/core/geo_nearwithin.js (renamed from jstests/geo_nearwithin.js)0
-rw-r--r--jstests/core/geo_or.js (renamed from jstests/geo_or.js)0
-rw-r--r--jstests/core/geo_poly_edge.js (renamed from jstests/geo_poly_edge.js)0
-rw-r--r--jstests/core/geo_poly_line.js (renamed from jstests/geo_poly_line.js)0
-rw-r--r--jstests/core/geo_polygon1.js (renamed from jstests/geo_polygon1.js)3
-rw-r--r--jstests/core/geo_polygon1_noindex.js (renamed from jstests/geo_polygon1_noindex.js)3
-rw-r--r--jstests/core/geo_polygon2.js263
-rw-r--r--jstests/core/geo_polygon3.js (renamed from jstests/geo_polygon3.js)0
-rw-r--r--jstests/core/geo_queryoptimizer.js (renamed from jstests/geo_queryoptimizer.js)0
-rw-r--r--jstests/core/geo_regex0.js (renamed from jstests/geo_regex0.js)0
-rw-r--r--jstests/core/geo_s2cursorlimitskip.js (renamed from jstests/geo_s2cursorlimitskip.js)3
-rw-r--r--jstests/core/geo_s2dedupnear.js (renamed from jstests/geo_s2dedupnear.js)0
-rw-r--r--jstests/core/geo_s2descindex.js (renamed from jstests/geo_s2descindex.js)0
-rw-r--r--jstests/core/geo_s2disjoint_holes.js (renamed from jstests/geo_s2disjoint_holes.js)29
-rw-r--r--jstests/core/geo_s2dupe_points.js (renamed from jstests/geo_s2dupe_points.js)3
-rwxr-xr-xjstests/core/geo_s2edgecases.js (renamed from jstests/geo_s2edgecases.js)0
-rw-r--r--jstests/core/geo_s2exact.js (renamed from jstests/geo_s2exact.js)0
-rw-r--r--jstests/core/geo_s2holesameasshell.js (renamed from jstests/geo_s2holesameasshell.js)6
-rwxr-xr-xjstests/core/geo_s2index.js (renamed from jstests/geo_s2index.js)43
-rwxr-xr-xjstests/core/geo_s2indexoldformat.js (renamed from jstests/geo_s2indexoldformat.js)12
-rw-r--r--jstests/core/geo_s2indexversion1.js (renamed from jstests/geo_s2indexversion1.js)0
-rw-r--r--jstests/core/geo_s2intersection.js (renamed from jstests/geo_s2intersection.js)0
-rw-r--r--jstests/core/geo_s2largewithin.js (renamed from jstests/geo_s2largewithin.js)0
-rw-r--r--jstests/core/geo_s2meridian.js (renamed from jstests/geo_s2meridian.js)3
-rw-r--r--jstests/core/geo_s2multi.js (renamed from jstests/geo_s2multi.js)12
-rw-r--r--jstests/core/geo_s2near.js (renamed from jstests/geo_s2near.js)0
-rw-r--r--jstests/core/geo_s2nearComplex.js (renamed from jstests/geo_s2nearComplex.js)9
-rw-r--r--jstests/core/geo_s2near_equator_opposite.js (renamed from jstests/geo_s2near_equator_opposite.js)0
-rw-r--r--jstests/core/geo_s2nearcorrect.js (renamed from jstests/geo_s2nearcorrect.js)0
-rw-r--r--jstests/core/geo_s2nearwithin.js (renamed from jstests/geo_s2nearwithin.js)5
-rw-r--r--jstests/core/geo_s2nongeoarray.js (renamed from jstests/geo_s2nongeoarray.js)6
-rwxr-xr-xjstests/core/geo_s2nonstring.js (renamed from jstests/geo_s2nonstring.js)0
-rw-r--r--jstests/core/geo_s2nopoints.js (renamed from jstests/geo_s2nopoints.js)0
-rw-r--r--jstests/core/geo_s2oddshapes.js (renamed from jstests/geo_s2oddshapes.js)0
-rw-r--r--jstests/core/geo_s2ordering.js (renamed from jstests/geo_s2ordering.js)11
-rw-r--r--jstests/core/geo_s2overlappingpolys.js (renamed from jstests/geo_s2overlappingpolys.js)0
-rwxr-xr-xjstests/core/geo_s2polywithholes.js (renamed from jstests/geo_s2polywithholes.js)6
-rw-r--r--jstests/core/geo_s2selfintersectingpoly.js (renamed from jstests/geo_s2selfintersectingpoly.js)3
-rw-r--r--jstests/core/geo_s2sparse.js (renamed from jstests/geo_s2sparse.js)0
-rw-r--r--jstests/core/geo_s2twofields.js (renamed from jstests/geo_s2twofields.js)5
-rw-r--r--jstests/core/geo_s2validindex.js (renamed from jstests/geo_s2validindex.js)8
-rw-r--r--jstests/core/geo_s2within.js (renamed from jstests/geo_s2within.js)0
-rw-r--r--jstests/core/geo_small_large.js158
-rw-r--r--jstests/core/geo_sort1.js (renamed from jstests/geo_sort1.js)0
-rw-r--r--jstests/core/geo_uniqueDocs.js (renamed from jstests/geo_uniqueDocs.js)0
-rw-r--r--jstests/core/geo_uniqueDocs2.js (renamed from jstests/geo_uniqueDocs2.js)0
-rw-r--r--jstests/core/geo_update.js (renamed from jstests/geo_update.js)0
-rw-r--r--jstests/core/geo_update1.js (renamed from jstests/geo_update1.js)12
-rw-r--r--jstests/core/geo_update2.js (renamed from jstests/geo_update2.js)11
-rw-r--r--jstests/core/geo_update_btree.js (renamed from jstests/geo_update_btree.js)19
-rw-r--r--jstests/core/geo_update_btree2.js (renamed from jstests/geo_update_btree2.js)0
-rw-r--r--jstests/core/geo_update_dedup.js (renamed from jstests/geo_update_dedup.js)24
-rw-r--r--jstests/core/geo_withinquery.js (renamed from jstests/geo_withinquery.js)0
-rw-r--r--jstests/core/geoa.js (renamed from jstests/geoa.js)0
-rw-r--r--jstests/core/geob.js (renamed from jstests/geob.js)0
-rw-r--r--jstests/core/geoc.js (renamed from jstests/geoc.js)0
-rw-r--r--jstests/core/geod.js (renamed from jstests/geod.js)0
-rw-r--r--jstests/core/geoe.js (renamed from jstests/geoe.js)0
-rw-r--r--jstests/core/geof.js (renamed from jstests/geof.js)0
-rw-r--r--jstests/core/geonear_cmd_input_validation.js (renamed from jstests/geonear_cmd_input_validation.js)0
-rw-r--r--jstests/core/geonear_validate.js (renamed from jstests/geonear_validate.js)0
-rw-r--r--jstests/core/getlog1.js (renamed from jstests/getlog1.js)0
-rw-r--r--jstests/core/getlog2.js (renamed from jstests/getlog2.js)3
-rw-r--r--jstests/core/group1.js (renamed from jstests/group1.js)0
-rw-r--r--jstests/core/group2.js (renamed from jstests/group2.js)0
-rw-r--r--jstests/core/group3.js (renamed from jstests/group3.js)0
-rw-r--r--jstests/core/group4.js (renamed from jstests/group4.js)0
-rw-r--r--jstests/core/group5.js (renamed from jstests/group5.js)0
-rw-r--r--jstests/core/group6.js (renamed from jstests/group6.js)0
-rw-r--r--jstests/core/group7.js (renamed from jstests/group7.js)10
-rw-r--r--jstests/core/group_empty.js (renamed from jstests/group_empty.js)0
-rw-r--r--jstests/core/grow_hash_table.js (renamed from jstests/grow_hash_table.js)5
-rw-r--r--jstests/core/hashindex1.js (renamed from jstests/hashindex1.js)0
-rw-r--r--jstests/core/hashtest1.js (renamed from jstests/hashtest1.js)0
-rw-r--r--jstests/core/hint1.js (renamed from jstests/hint1.js)0
-rw-r--r--jstests/core/hostinfo.js (renamed from jstests/hostinfo.js)0
-rw-r--r--jstests/core/id1.js (renamed from jstests/id1.js)0
-rw-r--r--jstests/core/idhack.js (renamed from jstests/idhack.js)0
-rw-r--r--jstests/core/in.js (renamed from jstests/in.js)0
-rw-r--r--jstests/core/in2.js (renamed from jstests/in2.js)0
-rw-r--r--jstests/core/in3.js (renamed from jstests/in3.js)0
-rw-r--r--jstests/core/in4.js (renamed from jstests/in4.js)0
-rw-r--r--jstests/core/in5.js (renamed from jstests/in5.js)0
-rw-r--r--jstests/core/in6.js (renamed from jstests/in6.js)0
-rw-r--r--jstests/core/in8.js (renamed from jstests/in8.js)0
-rw-r--r--jstests/core/in9.js (renamed from jstests/in9.js)0
-rw-r--r--jstests/core/ina.js (renamed from jstests/ina.js)0
-rw-r--r--jstests/core/inb.js (renamed from jstests/inb.js)0
-rw-r--r--jstests/core/inc-SERVER-7446.js (renamed from jstests/inc-SERVER-7446.js)20
-rw-r--r--jstests/core/inc1.js (renamed from jstests/inc1.js)0
-rw-r--r--jstests/core/inc2.js (renamed from jstests/inc2.js)0
-rw-r--r--jstests/core/inc3.js (renamed from jstests/inc3.js)0
-rw-r--r--jstests/core/index1.js (renamed from jstests/index1.js)0
-rw-r--r--jstests/core/index10.js (renamed from jstests/index10.js)8
-rw-r--r--jstests/core/index13.js (renamed from jstests/index13.js)0
-rw-r--r--jstests/core/index2.js (renamed from jstests/index2.js)0
-rw-r--r--jstests/core/index3.js (renamed from jstests/index3.js)0
-rw-r--r--jstests/core/index4.js (renamed from jstests/index4.js)0
-rw-r--r--jstests/core/index5.js (renamed from jstests/index5.js)0
-rw-r--r--jstests/core/index6.js (renamed from jstests/index6.js)0
-rw-r--r--jstests/core/index7.js (renamed from jstests/index7.js)0
-rw-r--r--jstests/core/index8.js (renamed from jstests/index8.js)0
-rw-r--r--jstests/core/index9.js (renamed from jstests/index9.js)0
-rw-r--r--jstests/core/indexOtherNamespace.js (renamed from jstests/indexOtherNamespace.js)20
-rw-r--r--jstests/core/indexStatsCommand.js (renamed from jstests/indexStatsCommand.js)0
-rw-r--r--jstests/core/index_arr1.js (renamed from jstests/index_arr1.js)0
-rw-r--r--jstests/core/index_arr2.js (renamed from jstests/index_arr2.js)4
-rw-r--r--jstests/core/index_big1.js (renamed from jstests/index_big1.js)4
-rwxr-xr-xjstests/core/index_bigkeys.js (renamed from jstests/index_bigkeys.js)0
-rw-r--r--jstests/core/index_bigkeys_update.js (renamed from jstests/index_bigkeys_update.js)4
-rw-r--r--jstests/core/index_bounds_number_edge_cases.js (renamed from jstests/index_bounds_number_edge_cases.js)0
-rw-r--r--jstests/core/index_check1.js (renamed from jstests/index_check1.js)0
-rw-r--r--jstests/core/index_check2.js (renamed from jstests/index_check2.js)0
-rw-r--r--jstests/core/index_check3.js (renamed from jstests/index_check3.js)0
-rw-r--r--jstests/core/index_check5.js (renamed from jstests/index_check5.js)0
-rw-r--r--jstests/core/index_check6.js (renamed from jstests/index_check6.js)0
-rw-r--r--jstests/core/index_check7.js (renamed from jstests/index_check7.js)0
-rw-r--r--jstests/core/index_check8.js (renamed from jstests/index_check8.js)0
-rw-r--r--jstests/core/index_diag.js (renamed from jstests/index_diag.js)0
-rw-r--r--jstests/core/index_elemmatch1.js (renamed from jstests/index_elemmatch1.js)4
-rw-r--r--jstests/core/index_filter_commands.js (renamed from jstests/index_filter_commands.js)0
-rw-r--r--jstests/core/index_many.js (renamed from jstests/index_many.js)6
-rw-r--r--jstests/core/index_many2.js (renamed from jstests/index_many2.js)0
-rw-r--r--jstests/core/index_sparse1.js (renamed from jstests/index_sparse1.js)3
-rw-r--r--jstests/core/index_sparse2.js (renamed from jstests/index_sparse2.js)0
-rw-r--r--jstests/core/indexa.js (renamed from jstests/indexa.js)0
-rw-r--r--jstests/core/indexapi.js (renamed from jstests/indexapi.js)12
-rw-r--r--jstests/core/indexb.js (renamed from jstests/indexb.js)0
-rw-r--r--jstests/core/indexc.js (renamed from jstests/indexc.js)0
-rw-r--r--jstests/core/indexd.js (renamed from jstests/indexd.js)0
-rw-r--r--jstests/core/indexe.js (renamed from jstests/indexe.js)2
-rw-r--r--jstests/core/indexes_on_indexes.js (renamed from jstests/indexes_on_indexes.js)0
-rw-r--r--jstests/core/indexf.js (renamed from jstests/indexf.js)0
-rw-r--r--jstests/core/indexg.js (renamed from jstests/indexg.js)0
-rw-r--r--jstests/core/indexh.js (renamed from jstests/indexh.js)0
-rw-r--r--jstests/core/indexi.js34
-rw-r--r--jstests/core/indexj.js (renamed from jstests/indexj.js)0
-rw-r--r--jstests/core/indexl.js (renamed from jstests/indexl.js)0
-rw-r--r--jstests/core/indexm.js (renamed from jstests/indexm.js)0
-rw-r--r--jstests/core/indexn.js (renamed from jstests/indexn.js)0
-rw-r--r--jstests/core/indexo.js (renamed from jstests/indexo.js)6
-rw-r--r--jstests/core/indexp.js23
-rw-r--r--jstests/core/indexq.js (renamed from jstests/indexq.js)0
-rw-r--r--jstests/core/indexr.js (renamed from jstests/indexr.js)0
-rw-r--r--jstests/core/indexs.js (renamed from jstests/indexs.js)0
-rw-r--r--jstests/core/indext.js (renamed from jstests/indext.js)0
-rw-r--r--jstests/core/indexu.js (renamed from jstests/indexu.js)87
-rw-r--r--jstests/core/indexv.js (renamed from jstests/indexv.js)0
-rw-r--r--jstests/core/indexw.js (renamed from jstests/indexw.js)0
-rw-r--r--jstests/core/insert1.js34
-rw-r--r--jstests/core/insert2.js13
-rw-r--r--jstests/core/insert_id_undefined.js (renamed from jstests/insert_id_undefined.js)1
-rw-r--r--jstests/core/insert_illegal_doc.js (renamed from jstests/insert_illegal_doc.js)0
-rw-r--r--jstests/core/insert_long_index_key.js (renamed from jstests/insert_long_index_key.js)0
-rw-r--r--jstests/core/ismaster.js (renamed from jstests/ismaster.js)0
-rw-r--r--jstests/fts_partition_no_multikey.js17
-rw-r--r--jstests/geo10.js21
-rw-r--r--jstests/geo4.js10
-rw-r--r--jstests/geo_center_sphere2.js164
-rw-r--r--jstests/geo_oob_sphere.js42
-rw-r--r--jstests/geo_polygon2.js266
-rw-r--r--jstests/geo_small_large.js151
-rwxr-xr-xjstests/indexbindata.js0
-rw-r--r--jstests/indexi.js43
-rw-r--r--jstests/indexp.js54
-rw-r--r--jstests/insert1.js44
-rw-r--r--jstests/insert2.js8
-rw-r--r--jstests/slowNightly/sharding_jscore_passthrough.js3
462 files changed, 1112 insertions, 1293 deletions
diff --git a/jstests/basicb.js b/jstests/basicb.js
deleted file mode 100644
index 0070f70068f..00000000000
--- a/jstests/basicb.js
+++ /dev/null
@@ -1,7 +0,0 @@
-
-t = db.basicb;
-t.drop();
-
-assert.throws( "t.insert( { '$a' : 5 } );" );
-t.insert( { '$a' : 5 } , 0, true );
-
diff --git a/jstests/all.js b/jstests/core/all.js
index 50087882ad1..50087882ad1 100644
--- a/jstests/all.js
+++ b/jstests/core/all.js
diff --git a/jstests/all2.js b/jstests/core/all2.js
index 64372ca5e97..64372ca5e97 100644
--- a/jstests/all2.js
+++ b/jstests/core/all2.js
diff --git a/jstests/all3.js b/jstests/core/all3.js
index b7a05321bbf..b7a05321bbf 100644
--- a/jstests/all3.js
+++ b/jstests/core/all3.js
diff --git a/jstests/all4.js b/jstests/core/all4.js
index 18acbf4f46a..109795754bc 100644
--- a/jstests/all4.js
+++ b/jstests/core/all4.js
@@ -5,9 +5,7 @@ t.drop();
function checkQuery( query, val ) {
assert.eq( val, t.count(query) );
- assert( !db.getLastError() );
assert.eq( val, t.find(query).itcount() );
- assert( !db.getLastError() );
}
checkQuery( {a:{$all:[]}}, 0 );
diff --git a/jstests/all5.js b/jstests/core/all5.js
index a5d9e312292..a5d9e312292 100644
--- a/jstests/all5.js
+++ b/jstests/core/all5.js
diff --git a/jstests/and.js b/jstests/core/and.js
index 4d8c2cd7d49..4d8c2cd7d49 100644
--- a/jstests/and.js
+++ b/jstests/core/and.js
diff --git a/jstests/and2.js b/jstests/core/and2.js
index 0bd13eb7a1d..0bd13eb7a1d 100644
--- a/jstests/and2.js
+++ b/jstests/core/and2.js
diff --git a/jstests/and3.js b/jstests/core/and3.js
index 036c63c02f0..036c63c02f0 100644
--- a/jstests/and3.js
+++ b/jstests/core/and3.js
diff --git a/jstests/andor.js b/jstests/core/andor.js
index f433ade8228..f433ade8228 100644
--- a/jstests/andor.js
+++ b/jstests/core/andor.js
diff --git a/jstests/apitest_db.js b/jstests/core/apitest_db.js
index c734d67bba7..c734d67bba7 100644
--- a/jstests/apitest_db.js
+++ b/jstests/core/apitest_db.js
diff --git a/jstests/apitest_dbcollection.js b/jstests/core/apitest_dbcollection.js
index 0983b065477..0983b065477 100644
--- a/jstests/apitest_dbcollection.js
+++ b/jstests/core/apitest_dbcollection.js
diff --git a/jstests/apply_ops1.js b/jstests/core/apply_ops1.js
index 9e6cb39f7c7..9e6cb39f7c7 100644
--- a/jstests/apply_ops1.js
+++ b/jstests/core/apply_ops1.js
diff --git a/jstests/apply_ops2.js b/jstests/core/apply_ops2.js
index 1a5923c3465..1a5923c3465 100644
--- a/jstests/apply_ops2.js
+++ b/jstests/core/apply_ops2.js
diff --git a/jstests/array1.js b/jstests/core/array1.js
index 4409b7bb4d3..4409b7bb4d3 100644
--- a/jstests/array1.js
+++ b/jstests/core/array1.js
diff --git a/jstests/array3.js b/jstests/core/array3.js
index 3d053f99417..3d053f99417 100644
--- a/jstests/array3.js
+++ b/jstests/core/array3.js
diff --git a/jstests/array4.js b/jstests/core/array4.js
index 1053e160f11..1053e160f11 100644
--- a/jstests/array4.js
+++ b/jstests/core/array4.js
diff --git a/jstests/array_match1.js b/jstests/core/array_match1.js
index f764fb913b1..f764fb913b1 100644
--- a/jstests/array_match1.js
+++ b/jstests/core/array_match1.js
diff --git a/jstests/array_match2.js b/jstests/core/array_match2.js
index d254b0a3fdd..d254b0a3fdd 100644
--- a/jstests/array_match2.js
+++ b/jstests/core/array_match2.js
diff --git a/jstests/array_match3.js b/jstests/core/array_match3.js
index c8653430770..c8653430770 100644
--- a/jstests/array_match3.js
+++ b/jstests/core/array_match3.js
diff --git a/jstests/array_match4.js b/jstests/core/array_match4.js
index b4cdec5143a..b4cdec5143a 100644
--- a/jstests/array_match4.js
+++ b/jstests/core/array_match4.js
diff --git a/jstests/arrayfind1.js b/jstests/core/arrayfind1.js
index 539fa6193a1..539fa6193a1 100644
--- a/jstests/arrayfind1.js
+++ b/jstests/core/arrayfind1.js
diff --git a/jstests/arrayfind2.js b/jstests/core/arrayfind2.js
index c6a78042c3d..c6a78042c3d 100644
--- a/jstests/arrayfind2.js
+++ b/jstests/core/arrayfind2.js
diff --git a/jstests/arrayfind3.js b/jstests/core/arrayfind3.js
index de038c84264..de038c84264 100644
--- a/jstests/arrayfind3.js
+++ b/jstests/core/arrayfind3.js
diff --git a/jstests/arrayfind4.js b/jstests/core/arrayfind4.js
index 17b02c8886b..17b02c8886b 100644
--- a/jstests/arrayfind4.js
+++ b/jstests/core/arrayfind4.js
diff --git a/jstests/arrayfind5.js b/jstests/core/arrayfind5.js
index 9ff6e2b8a5f..9ff6e2b8a5f 100644
--- a/jstests/arrayfind5.js
+++ b/jstests/core/arrayfind5.js
diff --git a/jstests/arrayfind6.js b/jstests/core/arrayfind6.js
index f4531cea96a..f4531cea96a 100644
--- a/jstests/arrayfind6.js
+++ b/jstests/core/arrayfind6.js
diff --git a/jstests/arrayfind7.js b/jstests/core/arrayfind7.js
index 7c44de1dc1d..7c44de1dc1d 100644
--- a/jstests/arrayfind7.js
+++ b/jstests/core/arrayfind7.js
diff --git a/jstests/arrayfind8.js b/jstests/core/arrayfind8.js
index 07d44ace26e..07d44ace26e 100644
--- a/jstests/arrayfind8.js
+++ b/jstests/core/arrayfind8.js
diff --git a/jstests/arrayfind9.js b/jstests/core/arrayfind9.js
index 4ee14c56580..4ee14c56580 100644
--- a/jstests/arrayfind9.js
+++ b/jstests/core/arrayfind9.js
diff --git a/jstests/arrayfinda.js b/jstests/core/arrayfinda.js
index 179d3985580..179d3985580 100644
--- a/jstests/arrayfinda.js
+++ b/jstests/core/arrayfinda.js
diff --git a/jstests/auth1.js b/jstests/core/auth1.js
index 4ab26e8d2e5..4ab26e8d2e5 100644
--- a/jstests/auth1.js
+++ b/jstests/core/auth1.js
diff --git a/jstests/auth2.js b/jstests/core/auth2.js
index 9c2b38f682d..9c2b38f682d 100644
--- a/jstests/auth2.js
+++ b/jstests/core/auth2.js
diff --git a/jstests/auth_copydb.js b/jstests/core/auth_copydb.js
index f04cd0b0d29..f04cd0b0d29 100644
--- a/jstests/auth_copydb.js
+++ b/jstests/core/auth_copydb.js
diff --git a/jstests/autoid.js b/jstests/core/autoid.js
index 6c8062fd093..6c8062fd093 100644
--- a/jstests/autoid.js
+++ b/jstests/core/autoid.js
diff --git a/jstests/bad_index_plugin.js b/jstests/core/bad_index_plugin.js
index 370eca4c4d7..98ebdb9bb28 100644
--- a/jstests/bad_index_plugin.js
+++ b/jstests/core/bad_index_plugin.js
@@ -1,11 +1,11 @@
// SERVER-5826 ensure you can't build an index with a non-existent plugin
t = db.bad_index_plugin;
-assert.eq(t.ensureIndex({good: 1}), undefined);
+assert.writeOK(t.ensureIndex({good: 1}));
assert.eq(t.getIndexes().length, 2); // good + _id
-err = t.ensureIndex({bad: 'bad'});
-assert.neq(err, undefined);
-assert(err.code >= 0);
+var err = t.ensureIndex({bad: 'bad'});
+assert.writeError(err);
+assert(err.getWriteError().code >= 0);
assert.eq(t.getIndexes().length, 2); // good + _id (no bad)
diff --git a/jstests/basic1.js b/jstests/core/basic1.js
index e5fa577f0b2..e5fa577f0b2 100644
--- a/jstests/basic1.js
+++ b/jstests/core/basic1.js
diff --git a/jstests/basic2.js b/jstests/core/basic2.js
index aaa3de4366e..aaa3de4366e 100644
--- a/jstests/basic2.js
+++ b/jstests/core/basic2.js
diff --git a/jstests/basic3.js b/jstests/core/basic3.js
index d778974f64a..5fb5581a252 100644
--- a/jstests/basic3.js
+++ b/jstests/core/basic3.js
@@ -5,17 +5,17 @@ t.drop()
//more diagnostics on bad save, if exception fails
doBadSave = function(param) {
print("doing save with " + tojson(param))
- t.save(param);
+ var res = t.save(param);
// Should not get here.
- printjson(db.getLastErrorObj());
+ printjson(res);
}
//more diagnostics on bad save, if exception fails
doBadUpdate = function(query, update) {
print("doing update with " + tojson(query) + " " + tojson(update))
- t.update(query, update);
+ var res = t.update(query, update);
// Should not get here.
- printjson(db.getLastErrorObj());
+ printjson(res);
}
assert.throws(doBadSave, [{"a.b":5}], ". in names aren't allowed doesn't work");
diff --git a/jstests/basic4.js b/jstests/core/basic4.js
index 0cf7a261e63..0cf7a261e63 100644
--- a/jstests/basic4.js
+++ b/jstests/core/basic4.js
diff --git a/jstests/basic5.js b/jstests/core/basic5.js
index bfa40fb8f5e..bfa40fb8f5e 100644
--- a/jstests/basic5.js
+++ b/jstests/core/basic5.js
diff --git a/jstests/basic6.js b/jstests/core/basic6.js
index e0cd6f1586e..e0cd6f1586e 100644
--- a/jstests/basic6.js
+++ b/jstests/core/basic6.js
diff --git a/jstests/basic7.js b/jstests/core/basic7.js
index 7bb0d470e82..7bb0d470e82 100644
--- a/jstests/basic7.js
+++ b/jstests/core/basic7.js
diff --git a/jstests/basic8.js b/jstests/core/basic8.js
index 513da0d15d1..513da0d15d1 100644
--- a/jstests/basic8.js
+++ b/jstests/core/basic8.js
diff --git a/jstests/basic9.js b/jstests/core/basic9.js
index b8308fba7d0..814b72b2ae7 100644
--- a/jstests/basic9.js
+++ b/jstests/core/basic9.js
@@ -5,9 +5,9 @@ t.drop()
// more diagnostics on bad save, if exception fails
doBadSave = function(param) {
print("doing save with " + tojson(param))
- t.save(param);
+ var res = t.save(param);
// Should not get here.
- printjson(db.getLastErrorObj());
+ print('Should have errored out: ' + tojson(res));
}
t.save({foo$foo:5});
diff --git a/jstests/basica.js b/jstests/core/basica.js
index 0cc364beb42..0cc364beb42 100644
--- a/jstests/basica.js
+++ b/jstests/core/basica.js
diff --git a/jstests/core/basicb.js b/jstests/core/basicb.js
new file mode 100644
index 00000000000..95eb60151af
--- /dev/null
+++ b/jstests/core/basicb.js
@@ -0,0 +1,6 @@
+
+t = db.basicb;
+t.drop();
+
+assert.throws( function() { t.insert( { '$a' : 5 } ); });
+
diff --git a/jstests/basicc.js b/jstests/core/basicc.js
index 0cd71ad32a0..8da8c68a8b0 100644
--- a/jstests/basicc.js
+++ b/jstests/core/basicc.js
@@ -10,12 +10,12 @@ js = "while( 1 ) { db.jstests.basicc1.save( {} ); }";
pid = startMongoProgramNoConnect( "mongo" , "--eval" , js , db.getMongo().host );
for( var i = 0; i < 1000; ++i ) {
- t2.save( {} );
+ assert.writeOK(t2.save( {} ));
}
-assert.automsg( "!db.getLastError()" );
+
stopMongoProgramByPid( pid );
// put things back the way we found it
t1.drop();
t2.drop();
db.dropDatabase();
-db = db.getSisterDB("test"); \ No newline at end of file
+db = db.getSisterDB("test");
diff --git a/jstests/batch_size.js b/jstests/core/batch_size.js
index 2bc144cd554..2bc144cd554 100644
--- a/jstests/batch_size.js
+++ b/jstests/core/batch_size.js
diff --git a/jstests/bench_test1.js b/jstests/core/bench_test1.js
index bb1423ee8b8..bb1423ee8b8 100644
--- a/jstests/bench_test1.js
+++ b/jstests/core/bench_test1.js
diff --git a/jstests/bench_test2.js b/jstests/core/bench_test2.js
index e2057ac693e..871b24ca051 100644
--- a/jstests/bench_test2.js
+++ b/jstests/core/bench_test2.js
@@ -4,7 +4,6 @@ t.drop();
for ( i=0; i<100; i++ )
t.insert( { _id : i , x : 0 } );
-db.getLastError();
benchArgs = { ops : [ { ns : t.getFullName() ,
op : "update" ,
diff --git a/jstests/bench_test3.js b/jstests/core/bench_test3.js
index 4bc21ed2505..4bc21ed2505 100644
--- a/jstests/bench_test3.js
+++ b/jstests/core/bench_test3.js
diff --git a/jstests/big_object1.js b/jstests/core/big_object1.js
index 07c4150fb53..be61dbd3041 100644
--- a/jstests/big_object1.js
+++ b/jstests/core/big_object1.js
@@ -11,18 +11,19 @@ if ( db.adminCommand( "buildinfo" ).bits == 64 ){
}
x = 0;
while ( true ){
+ var result;
n = { _id : x , a : [] }
for ( i=0; i<14+x; i++ )
n.a.push( s )
try {
- t.insert( n )
+ result = t.insert( n )
o = n
}
catch ( e ){
break;
}
- if ( db.getLastError() != null )
+ if ( result.hasWriteErrors() )
break;
x++;
}
diff --git a/jstests/binData.js b/jstests/core/binData.js
index 3f037650e05..3f037650e05 100644
--- a/jstests/binData.js
+++ b/jstests/core/binData.js
diff --git a/jstests/block_check_supported.js b/jstests/core/block_check_supported.js
index 21d04ca93c7..21d04ca93c7 100644
--- a/jstests/block_check_supported.js
+++ b/jstests/core/block_check_supported.js
diff --git a/jstests/bulk_insert.js b/jstests/core/bulk_insert.js
index e26b323c6d9..e26b323c6d9 100644
--- a/jstests/bulk_insert.js
+++ b/jstests/core/bulk_insert.js
diff --git a/jstests/capped.js b/jstests/core/capped.js
index 421132b6f75..421132b6f75 100644
--- a/jstests/capped.js
+++ b/jstests/core/capped.js
diff --git a/jstests/capped1.js b/jstests/core/capped1.js
index 0bbeaa40894..0bbeaa40894 100644
--- a/jstests/capped1.js
+++ b/jstests/core/capped1.js
diff --git a/jstests/capped2.js b/jstests/core/capped2.js
index 65bb82f4c07..65bb82f4c07 100644
--- a/jstests/capped2.js
+++ b/jstests/core/capped2.js
diff --git a/jstests/capped3.js b/jstests/core/capped3.js
index 2e5e6790cb7..2e5e6790cb7 100644
--- a/jstests/capped3.js
+++ b/jstests/core/capped3.js
diff --git a/jstests/capped5.js b/jstests/core/capped5.js
index 37b776ee1ca..37b776ee1ca 100644
--- a/jstests/capped5.js
+++ b/jstests/core/capped5.js
diff --git a/jstests/capped6.js b/jstests/core/capped6.js
index 5db12b2fcf9..5db12b2fcf9 100644
--- a/jstests/capped6.js
+++ b/jstests/core/capped6.js
diff --git a/jstests/capped7.js b/jstests/core/capped7.js
index 693828da85f..693828da85f 100644
--- a/jstests/capped7.js
+++ b/jstests/core/capped7.js
diff --git a/jstests/capped8.js b/jstests/core/capped8.js
index 0f30e37aebf..0f30e37aebf 100644
--- a/jstests/capped8.js
+++ b/jstests/core/capped8.js
diff --git a/jstests/capped9.js b/jstests/core/capped9.js
index 9ea506ce795..2e0c2c74640 100644
--- a/jstests/capped9.js
+++ b/jstests/core/capped9.js
@@ -18,8 +18,7 @@ t.ensureIndex( { _id : 1 } )
assert.eq( 1 , t.find( { _id : 1 } ).itcount() , "D1" )
-t.update( { _id : 1 } , { $set : { y : 4 } } )
-assert( null == db.getLastError() , "D1: " + tojson( db.getLastError() ) )
+assert.writeOK( t.update( { _id: 1 }, { $set: { y: 4 } } ));
assert.eq( 4 , t.findOne().y , "D2" )
diff --git a/jstests/capped_empty.js b/jstests/core/capped_empty.js
index 5b0fb6b8f8e..5b0fb6b8f8e 100644
--- a/jstests/capped_empty.js
+++ b/jstests/core/capped_empty.js
diff --git a/jstests/capped_max.js b/jstests/core/capped_max.js
index 1d7cbc3ef23..1d7cbc3ef23 100644
--- a/jstests/capped_max.js
+++ b/jstests/core/capped_max.js
diff --git a/jstests/capped_server2639.js b/jstests/core/capped_server2639.js
index 465fd4ae874..adc6f994163 100644
--- a/jstests/capped_server2639.js
+++ b/jstests/core/capped_server2639.js
@@ -15,9 +15,9 @@ while ( bigString.length < size )
t.insert( { x : 1 } );
-t.insert( { x : 2 , bigString : bigString } );
-gle = db.getLastErrorObj();
-assert.eq( 16328 , gle.code , tojson( gle ) )
+var res = t.insert( { x : 2 , bigString : bigString } );
+assert.writeError( res );
+assert.eq( 16328, res.getWriteError().code, res.getWriteError().toString() );
assert.eq( 1 , t.count() ); // make sure small doc didn't get deleted
assert.eq( 1 , t.findOne().x );
diff --git a/jstests/capped_server7543.js b/jstests/core/capped_server7543.js
index 514cd7964b2..514cd7964b2 100644
--- a/jstests/capped_server7543.js
+++ b/jstests/core/capped_server7543.js
diff --git a/jstests/cappeda.js b/jstests/core/cappeda.js
index 4a4b14a64e5..3244ffae84f 100644
--- a/jstests/cappeda.js
+++ b/jstests/core/cappeda.js
@@ -13,10 +13,9 @@ function q() {
}
function u() {
- t.update( { _id : 5 } , { $set : { x : 2 } } );
- var gle = db.getLastError();
- if ( gle )
- throw gle;
+ var res = t.update( { _id : 5 } , { $set : { x : 2 } } );
+ if ( res.hasWriteErrors() )
+ throw res;
}
diff --git a/jstests/check_shard_index.js b/jstests/core/check_shard_index.js
index f85071124fb..f85071124fb 100644
--- a/jstests/check_shard_index.js
+++ b/jstests/core/check_shard_index.js
diff --git a/jstests/collmod.js b/jstests/core/collmod.js
index 2dc5555f3ec..2dc5555f3ec 100644
--- a/jstests/collmod.js
+++ b/jstests/core/collmod.js
diff --git a/jstests/compact.js b/jstests/core/compact.js
index 2121debc17e..2121debc17e 100644
--- a/jstests/compact.js
+++ b/jstests/core/compact.js
diff --git a/jstests/compact2.js b/jstests/core/compact2.js
index 0a7c343a3f9..0a7c343a3f9 100644
--- a/jstests/compact2.js
+++ b/jstests/core/compact2.js
diff --git a/jstests/compactPreservePadding.js b/jstests/core/compactPreservePadding.js
index 4748afb9a82..4748afb9a82 100644
--- a/jstests/compactPreservePadding.js
+++ b/jstests/core/compactPreservePadding.js
diff --git a/jstests/connection_status.js b/jstests/core/connection_status.js
index 08d05cbf28d..08d05cbf28d 100644
--- a/jstests/connection_status.js
+++ b/jstests/core/connection_status.js
diff --git a/jstests/connection_string_validation.js b/jstests/core/connection_string_validation.js
index 4ecd1f926ee..4ecd1f926ee 100644
--- a/jstests/connection_string_validation.js
+++ b/jstests/core/connection_string_validation.js
diff --git a/jstests/constructors.js b/jstests/core/constructors.js
index 5d4dd177425..ac8ae08d7c0 100644
--- a/jstests/constructors.js
+++ b/jstests/core/constructors.js
@@ -89,8 +89,7 @@ function whereConstructorTest (constructorList) {
constructorList = addConstructorsWithNew(constructorList);
t = db.where_constructors;
t.drop();
- t.insert({ x : 1 });
- assert(!db.getLastError());
+ assert.writeOK( t.insert({ x : 1 }));
constructorList.valid.forEach(function (constructor) {
try {
diff --git a/jstests/copydb.js b/jstests/core/copydb.js
index 7c7c02542a4..7c7c02542a4 100644
--- a/jstests/copydb.js
+++ b/jstests/core/copydb.js
diff --git a/jstests/count.js b/jstests/core/count.js
index 5502d7176c1..5502d7176c1 100644
--- a/jstests/count.js
+++ b/jstests/core/count.js
diff --git a/jstests/count10.js b/jstests/core/count10.js
index ed966ffe3fe..21243b3151d 100644
--- a/jstests/count10.js
+++ b/jstests/core/count10.js
@@ -6,8 +6,6 @@ t.drop();
for ( i=0; i<100; i++ ){
t.save( { x : i } );
}
-// Make sure data is written.
-db.getLastError();
// Start a parallel shell which repeatedly checks for a count
// query using db.currentOp(). As soon as the op is found,
diff --git a/jstests/count2.js b/jstests/core/count2.js
index 4d060aaac20..4d060aaac20 100644
--- a/jstests/count2.js
+++ b/jstests/core/count2.js
diff --git a/jstests/count3.js b/jstests/core/count3.js
index a8c3ef5faad..a8c3ef5faad 100644
--- a/jstests/count3.js
+++ b/jstests/core/count3.js
diff --git a/jstests/count4.js b/jstests/core/count4.js
index 7be74362603..7be74362603 100644
--- a/jstests/count4.js
+++ b/jstests/core/count4.js
diff --git a/jstests/count5.js b/jstests/core/count5.js
index b6bbc543352..b6bbc543352 100644
--- a/jstests/count5.js
+++ b/jstests/core/count5.js
diff --git a/jstests/count6.js b/jstests/core/count6.js
index 44c5fa33bc7..44c5fa33bc7 100644
--- a/jstests/count6.js
+++ b/jstests/core/count6.js
diff --git a/jstests/count7.js b/jstests/core/count7.js
index c2c1260d49b..c2c1260d49b 100644
--- a/jstests/count7.js
+++ b/jstests/core/count7.js
diff --git a/jstests/count9.js b/jstests/core/count9.js
index 888ffe3b544..888ffe3b544 100644
--- a/jstests/count9.js
+++ b/jstests/core/count9.js
diff --git a/jstests/count_hint.js b/jstests/core/count_hint.js
index 93322d282db..93322d282db 100644
--- a/jstests/count_hint.js
+++ b/jstests/core/count_hint.js
diff --git a/jstests/counta.js b/jstests/core/counta.js
index f0834d455dd..f0834d455dd 100644
--- a/jstests/counta.js
+++ b/jstests/core/counta.js
diff --git a/jstests/countb.js b/jstests/core/countb.js
index 8f7131a5a6c..8f7131a5a6c 100644
--- a/jstests/countb.js
+++ b/jstests/core/countb.js
diff --git a/jstests/countc.js b/jstests/core/countc.js
index 260dbb1f264..260dbb1f264 100644
--- a/jstests/countc.js
+++ b/jstests/core/countc.js
diff --git a/jstests/coveredIndex1.js b/jstests/core/coveredIndex1.js
index ce11f89ceed..ce11f89ceed 100644
--- a/jstests/coveredIndex1.js
+++ b/jstests/core/coveredIndex1.js
diff --git a/jstests/coveredIndex2.js b/jstests/core/coveredIndex2.js
index 56a23f43211..56a23f43211 100644
--- a/jstests/coveredIndex2.js
+++ b/jstests/core/coveredIndex2.js
diff --git a/jstests/coveredIndex3.js b/jstests/core/coveredIndex3.js
index 66180342605..66180342605 100644
--- a/jstests/coveredIndex3.js
+++ b/jstests/core/coveredIndex3.js
diff --git a/jstests/coveredIndex4.js b/jstests/core/coveredIndex4.js
index 136eba603cf..136eba603cf 100644
--- a/jstests/coveredIndex4.js
+++ b/jstests/core/coveredIndex4.js
diff --git a/jstests/coveredIndex5.js b/jstests/core/coveredIndex5.js
index ee383cd93e2..ee383cd93e2 100644
--- a/jstests/coveredIndex5.js
+++ b/jstests/core/coveredIndex5.js
diff --git a/jstests/covered_index_compound_1.js b/jstests/core/covered_index_compound_1.js
index 7e529785d12..7e529785d12 100644
--- a/jstests/covered_index_compound_1.js
+++ b/jstests/core/covered_index_compound_1.js
diff --git a/jstests/covered_index_geo_1.js b/jstests/core/covered_index_geo_1.js
index 1d647dfa94c..1d647dfa94c 100644
--- a/jstests/covered_index_geo_1.js
+++ b/jstests/core/covered_index_geo_1.js
diff --git a/jstests/covered_index_geo_2.js b/jstests/core/covered_index_geo_2.js
index 52f610b7e64..52f610b7e64 100644
--- a/jstests/covered_index_geo_2.js
+++ b/jstests/core/covered_index_geo_2.js
diff --git a/jstests/covered_index_negative_1.js b/jstests/core/covered_index_negative_1.js
index ab03e7566f6..ab03e7566f6 100644
--- a/jstests/covered_index_negative_1.js
+++ b/jstests/core/covered_index_negative_1.js
diff --git a/jstests/covered_index_simple_1.js b/jstests/core/covered_index_simple_1.js
index 44e3c00a9f8..44e3c00a9f8 100644
--- a/jstests/covered_index_simple_1.js
+++ b/jstests/core/covered_index_simple_1.js
diff --git a/jstests/covered_index_simple_2.js b/jstests/core/covered_index_simple_2.js
index 313cca439d8..313cca439d8 100644
--- a/jstests/covered_index_simple_2.js
+++ b/jstests/core/covered_index_simple_2.js
diff --git a/jstests/covered_index_simple_3.js b/jstests/core/covered_index_simple_3.js
index ee586540ea4..ee586540ea4 100644
--- a/jstests/covered_index_simple_3.js
+++ b/jstests/core/covered_index_simple_3.js
diff --git a/jstests/covered_index_simple_id.js b/jstests/core/covered_index_simple_id.js
index c7f6811a33c..c7f6811a33c 100644
--- a/jstests/covered_index_simple_id.js
+++ b/jstests/core/covered_index_simple_id.js
diff --git a/jstests/covered_index_sort_1.js b/jstests/core/covered_index_sort_1.js
index adfcb5c6cb6..adfcb5c6cb6 100644
--- a/jstests/covered_index_sort_1.js
+++ b/jstests/core/covered_index_sort_1.js
diff --git a/jstests/covered_index_sort_2.js b/jstests/core/covered_index_sort_2.js
index e5dd48b47af..e5dd48b47af 100644
--- a/jstests/covered_index_sort_2.js
+++ b/jstests/core/covered_index_sort_2.js
diff --git a/jstests/covered_index_sort_3.js b/jstests/core/covered_index_sort_3.js
index 8f5986c4d76..8f5986c4d76 100644
--- a/jstests/covered_index_sort_3.js
+++ b/jstests/core/covered_index_sort_3.js
diff --git a/jstests/create_indexes.js b/jstests/core/create_indexes.js
index e83799a57ab..6c54c4de0cb 100644
--- a/jstests/create_indexes.js
+++ b/jstests/core/create_indexes.js
@@ -1,30 +1,65 @@
-
t = db.create_indexes;
t.drop();
+// TODO: revisit this after createIndexes api stabilizes.
+var isMongos = ("isdbgrid" == db.runCommand("ismaster").msg);
+var extractResult = function(obj) {
+ if (!isMongos) return obj;
+
+ // Sample mongos format:
+ // {
+ // raw: {
+ // "localhost:30000": {
+ // createdCollectionAutomatically: false,
+ // numIndexesBefore: 3,
+ // numIndexesAfter: 5,
+ // ok: 1
+ // }
+ // },
+ // ok: 1
+ // }
+
+ var numFields = 0;
+ var result = null;
+ for (var field in obj.raw) {
+ result = obj.raw[field];
+ numFields++;
+ }
+
+ assert.neq(null, result);
+ assert.eq(1, numFields);
+ return result;
+};
+
+
res = t.runCommand( "createIndexes", { indexes : [ { key : { "x" : 1 }, name : "x_1" } ] } );
+res = extractResult( res );
assert( res.createdCollectionAutomatically );
assert.eq( 1, res.numIndexesBefore );
assert.eq( 2, res.numIndexesAfter );
res = t.runCommand( "createIndexes", { indexes : [ { key : { "x" : 1 }, name : "x_1" } ] } );
+res = extractResult( res );
assert.eq( 2, res.numIndexesBefore );
assert( res.noChangesMade );
res = t.runCommand( "createIndexes", { indexes : [ { key : { "x" : 1 }, name : "x_1" },
{ key : { "y" : 1 }, name : "y_1" } ] } );
+res = extractResult( res );
assert( !res.createdCollectionAutomatically );
assert.eq( 2, res.numIndexesBefore );
assert.eq( 3, res.numIndexesAfter );
res = t.runCommand( "createIndexes", { indexes : [ { key : { "a" : 1 }, name : "a_1" },
{ key : { "b" : 1 }, name : "b_1" } ] } );
+res = extractResult( res );
assert( !res.createdCollectionAutomatically );
assert.eq( 3, res.numIndexesBefore );
assert.eq( 5, res.numIndexesAfter );
res = t.runCommand( "createIndexes", { indexes : [ { key : { "a" : 1 }, name : "a_1" },
{ key : { "b" : 1 }, name : "b_1" } ] } );
+res = extractResult( res );
assert.eq( 5, res.numIndexesBefore );
assert( res.noChangesMade );
diff --git a/jstests/currentop.js b/jstests/core/currentop.js
index be822bf88f2..e1d2e73cc7a 100644
--- a/jstests/currentop.js
+++ b/jstests/core/currentop.js
@@ -7,8 +7,6 @@ t.drop();
for(i=0;i<100;i++) {
t.save({ "num": i });
}
-// Make sure data is written before we start reading it in parallel shells.
-db.getLastError();
print("count:" + t.count());
@@ -41,7 +39,8 @@ assert.soon( function(){
}, "have_some_ops");
print("ok");
-s2 = startParallelShell( "db.jstests_currentop.update( { '$where': function() { sleep(150); } }, { 'num': 1 }, false, true ); db.getLastError()" );
+s2 = startParallelShell( "db.jstests_currentop.update({ '$where': function() { sleep(150); } }," +
+ " { 'num': 1 }, false, true );" );
o = [];
diff --git a/jstests/cursor1.js b/jstests/core/cursor1.js
index 8448752bb0c..8448752bb0c 100644
--- a/jstests/cursor1.js
+++ b/jstests/core/cursor1.js
diff --git a/jstests/cursor2.js b/jstests/core/cursor2.js
index 2389a6a5d74..2389a6a5d74 100644
--- a/jstests/cursor2.js
+++ b/jstests/core/cursor2.js
diff --git a/jstests/cursor3.js b/jstests/core/cursor3.js
index d23264c94ba..d23264c94ba 100644
--- a/jstests/cursor3.js
+++ b/jstests/core/cursor3.js
diff --git a/jstests/cursor4.js b/jstests/core/cursor4.js
index b08a72f62e5..b08a72f62e5 100644
--- a/jstests/cursor4.js
+++ b/jstests/core/cursor4.js
diff --git a/jstests/cursor5.js b/jstests/core/cursor5.js
index 6434d2b3887..6434d2b3887 100644
--- a/jstests/cursor5.js
+++ b/jstests/core/cursor5.js
diff --git a/jstests/cursor6.js b/jstests/core/cursor6.js
index 33944eafd3a..33944eafd3a 100644
--- a/jstests/cursor6.js
+++ b/jstests/core/cursor6.js
diff --git a/jstests/cursor7.js b/jstests/core/cursor7.js
index 97cfbb738b3..97cfbb738b3 100644
--- a/jstests/cursor7.js
+++ b/jstests/core/cursor7.js
diff --git a/jstests/cursora.js b/jstests/core/cursora.js
index a46688a7147..6710c1e9dc6 100644
--- a/jstests/cursora.js
+++ b/jstests/core/cursora.js
@@ -7,13 +7,15 @@ function run( n , atomic ){
assert(isNumber(n), "cursora.js isNumber");
}
t.drop()
-
+
+ var bulk = t.initializeUnorderedBulkOp();
for ( i=0; i<n; i++ )
- t.insert( { _id : i } )
- db.getLastError()
+ bulk.insert( { _id : i } );
+ assert.writeOK(bulk.execute());
print("cursora.js startParallelShell n:"+n+" atomic:"+atomic)
- join = startParallelShell( "sleep(50); db.cursora.remove( {" + ( atomic ? "$atomic:true" : "" ) + "} ); db.getLastError();" );
+ join = startParallelShell( "sleep(50);" +
+ "db.cursora.remove({" + ( atomic ? "$atomic:true" : "" ) + "});" );
var start = null;
var ex = null;
diff --git a/jstests/cursorb.js b/jstests/core/cursorb.js
index 65e356e89cb..65e356e89cb 100644
--- a/jstests/cursorb.js
+++ b/jstests/core/cursorb.js
diff --git a/jstests/datasize.js b/jstests/core/datasize.js
index 13e9f11bf0c..13e9f11bf0c 100644
--- a/jstests/datasize.js
+++ b/jstests/core/datasize.js
diff --git a/jstests/datasize2.js b/jstests/core/datasize2.js
index 103cb2096ee..103cb2096ee 100644
--- a/jstests/datasize2.js
+++ b/jstests/core/datasize2.js
diff --git a/jstests/datasize3.js b/jstests/core/datasize3.js
index df79e6d9b04..df79e6d9b04 100644
--- a/jstests/datasize3.js
+++ b/jstests/core/datasize3.js
diff --git a/jstests/date1.js b/jstests/core/date1.js
index e6fc147f9f4..e6fc147f9f4 100644
--- a/jstests/date1.js
+++ b/jstests/core/date1.js
diff --git a/jstests/date2.js b/jstests/core/date2.js
index ec13865a862..ec13865a862 100644
--- a/jstests/date2.js
+++ b/jstests/core/date2.js
diff --git a/jstests/date3.js b/jstests/core/date3.js
index e7ddf717c73..e7ddf717c73 100644
--- a/jstests/date3.js
+++ b/jstests/core/date3.js
diff --git a/jstests/db.js b/jstests/core/db.js
index 66a0bd73ede..66a0bd73ede 100644
--- a/jstests/db.js
+++ b/jstests/core/db.js
diff --git a/jstests/dbadmin.js b/jstests/core/dbadmin.js
index bab348d5700..bab348d5700 100644
--- a/jstests/dbadmin.js
+++ b/jstests/core/dbadmin.js
diff --git a/jstests/dbcase.js b/jstests/core/dbcase.js
index 25c0bcab37a..c3aa466ba17 100644
--- a/jstests/dbcase.js
+++ b/jstests/core/dbcase.js
@@ -6,13 +6,11 @@ b = db.getSisterDB( "dbcasetest_dbnameA" )
a.dropDatabase();
b.dropDatabase();
-a.foo.save( { x : 1 } )
-z = db.getLastErrorObj();
-assert.eq( 0 , z.code || 0 , "A : " + tojson(z) )
+assert.writeOK( a.foo.save( { x : 1 } ));
-b.foo.save( { x : 1 } )
-z = db.getLastErrorObj();
-assert.eq( 13297 , z.code || 0 , "B : " + tojson(z) )
+res = b.foo.save( { x : 1 } );
+assert.writeError( res );
+assert.eq( 13297, res.getWriteError().code, res.toString() );
assert.neq( -1, db.getMongo().getDBNames().indexOf( a.getName() ) );
assert.eq( -1, db.getMongo().getDBNames().indexOf( b.getName() ) );
diff --git a/jstests/dbcase2.js b/jstests/core/dbcase2.js
index f9973d98837..f9973d98837 100644
--- a/jstests/dbcase2.js
+++ b/jstests/core/dbcase2.js
diff --git a/jstests/dbhash.js b/jstests/core/dbhash.js
index 7fea4b4d50c..7fea4b4d50c 100644
--- a/jstests/dbhash.js
+++ b/jstests/core/dbhash.js
diff --git a/jstests/dbhash2.js b/jstests/core/dbhash2.js
index ac491291c2b..ac491291c2b 100644
--- a/jstests/dbhash2.js
+++ b/jstests/core/dbhash2.js
diff --git a/jstests/dbref1.js b/jstests/core/dbref1.js
index 4a827662c1a..4a827662c1a 100644
--- a/jstests/dbref1.js
+++ b/jstests/core/dbref1.js
diff --git a/jstests/dbref2.js b/jstests/core/dbref2.js
index d1b4870322d..d1b4870322d 100644
--- a/jstests/dbref2.js
+++ b/jstests/core/dbref2.js
diff --git a/jstests/dbref3.js b/jstests/core/dbref3.js
index 2f3ab8fa79c..2f3ab8fa79c 100644
--- a/jstests/dbref3.js
+++ b/jstests/core/dbref3.js
diff --git a/jstests/delx.js b/jstests/core/delx.js
index aa858e92cbd..d28b2063898 100644
--- a/jstests/delx.js
+++ b/jstests/core/delx.js
@@ -7,7 +7,6 @@ function setup( mydb ){
for ( i=0; i<100; i++ ){
mydb.foo.insert( { _id : i } );
}
- mydb.getLastError();
}
setup( a );
@@ -23,7 +22,6 @@ x.next();
y.next();
a.foo.remove( { _id : { $gt : 50 } } );
-db.getLastError();
assert.eq( 51 , a.foo.find().itcount() , "B1" )
assert.eq( 100 , b.foo.find().itcount() , "B2" )
diff --git a/jstests/depth_limit.js b/jstests/core/depth_limit.js
index 7523a1fc9fe..7523a1fc9fe 100644
--- a/jstests/depth_limit.js
+++ b/jstests/core/depth_limit.js
diff --git a/jstests/distinct1.js b/jstests/core/distinct1.js
index 03e425af761..03e425af761 100644
--- a/jstests/distinct1.js
+++ b/jstests/core/distinct1.js
diff --git a/jstests/distinct2.js b/jstests/core/distinct2.js
index 41ee78c5117..41ee78c5117 100644
--- a/jstests/distinct2.js
+++ b/jstests/core/distinct2.js
diff --git a/jstests/distinct3.js b/jstests/core/distinct3.js
index 336663d3b0d..0add7aeb95e 100644
--- a/jstests/distinct3.js
+++ b/jstests/core/distinct3.js
@@ -6,28 +6,30 @@ t.drop();
t.ensureIndex({a:1});
t.ensureIndex({b:1});
+var bulk = t.initializeUnorderedBulkOp();
for( i = 0; i < 50; ++i ) {
- for( j = 0; j < 20; ++j ) {
- t.save({a:i,c:i,d:j});
+ for( j = 0; j < 2; ++j ) {
+ bulk.insert({a:i,c:i,d:j});
}
}
-for( i = 0; i < 1000; ++i ) {
- t.save({b:i,c:i+50});
+for( i = 0; i < 100; ++i ) {
+ bulk.insert({b:i,c:i+50});
}
-db.getLastError();
+assert.writeOK(bulk.execute());
// Attempt to remove the last match for the {a:1} index scan while distinct is yielding.
-p = startParallelShell( 'for( i = 0; i < 2500; ++i ) { ' +
- ' db.jstests_distinct3.remove( { a:49 } ); ' +
+p = startParallelShell( 'var bulk = db.jstests_distinct3.initializeUnorderedBulkOp();' +
+ 'for( i = 0; i < 100; ++i ) { ' +
+ ' bulk.remove( { a:49 } ); ' +
' for( j = 0; j < 20; ++j ) { ' +
- ' db.jstests_distinct3.save( { a:49, c:49, d:j } ); ' +
+ ' bulk.insert( { a:49, c:49, d:j } ); ' +
' } ' +
- '} ' +
- 'db.getLastError(); ' );
+ ' bulk.execute(); ' +
+ '} ' );
for( i = 0; i < 100; ++i ) {
count = t.distinct( 'c', {$or:[{a:{$gte:0},d:0},{b:{$gte:0}}]} ).length;
- assert.gt( count, 1000 );
+ assert.gt( count, 100 );
}
p();
diff --git a/jstests/distinct_array1.js b/jstests/core/distinct_array1.js
index 2f289ad2e79..2f289ad2e79 100644
--- a/jstests/distinct_array1.js
+++ b/jstests/core/distinct_array1.js
diff --git a/jstests/distinct_index1.js b/jstests/core/distinct_index1.js
index 6de1a7927e4..6de1a7927e4 100644
--- a/jstests/distinct_index1.js
+++ b/jstests/core/distinct_index1.js
diff --git a/jstests/distinct_index2.js b/jstests/core/distinct_index2.js
index 67d28b8b95e..67d28b8b95e 100644
--- a/jstests/distinct_index2.js
+++ b/jstests/core/distinct_index2.js
diff --git a/jstests/distinct_speed1.js b/jstests/core/distinct_speed1.js
index 4cae5b0ae06..4cae5b0ae06 100644
--- a/jstests/distinct_speed1.js
+++ b/jstests/core/distinct_speed1.js
diff --git a/jstests/drop.js b/jstests/core/drop.js
index 154c35d1db3..154c35d1db3 100644
--- a/jstests/drop.js
+++ b/jstests/core/drop.js
diff --git a/jstests/drop2.js b/jstests/core/drop2.js
index 9eb3aef93cd..5eef20adc61 100644
--- a/jstests/drop2.js
+++ b/jstests/core/drop2.js
@@ -6,7 +6,6 @@ function debug( x ) {
}
coll.save( {} );
-db.getLastError();
function getOpId( drop ) {
var inProg = db.currentOp().inprog;
diff --git a/jstests/drop3.js b/jstests/core/drop3.js
index b2ca94a1550..d97b40989b8 100644
--- a/jstests/drop3.js
+++ b/jstests/core/drop3.js
@@ -19,11 +19,7 @@ assert.eq( cursor.objsLeftInBatch(), 1 );
assert.eq( subcursor.objsLeftInBatch(), 1 );
t.drop(); // should invalidate cursor, but not subcursor
-db.getLastError();
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/drop_index.js b/jstests/core/drop_index.js
index 8e2278d00c5..8e2278d00c5 100644
--- a/jstests/drop_index.js
+++ b/jstests/core/drop_index.js
diff --git a/jstests/dropdb.js b/jstests/core/dropdb.js
index 58e3dd9fdaa..0c080ffb286 100644
--- a/jstests/dropdb.js
+++ b/jstests/core/dropdb.js
@@ -16,7 +16,6 @@ function check(shouldExist) {
}
ddb.c.save( {} );
-ddb.getLastError();
check(true);
ddb.dropDatabase();
diff --git a/jstests/dropdb_race.js b/jstests/core/dropdb_race.js
index bff7980011a..61fa0887ef5 100644
--- a/jstests/dropdb_race.js
+++ b/jstests/core/dropdb_race.js
@@ -14,11 +14,8 @@ var start = new Date();
for (var pass = 0; pass < 100; pass++) {
if (pass % 2 == 0) {
// sometimes wait for create db first, to vary the timing of things
- t.insert({});
- if( pass % 4 == 0 )
- d.runCommand({getLastError:1,j:1});
- else
- d.getLastError();
+ var options = ( pass % 4 == 0 )? { writeConcern: { j: true }} : undefined;
+ t.insert({}, options);
}
t.insert({ x: 1 });
t.insert({ x: 3 });
diff --git a/jstests/elemMatchProjection.js b/jstests/core/elemMatchProjection.js
index 73088fab699..73088fab699 100644
--- a/jstests/elemMatchProjection.js
+++ b/jstests/core/elemMatchProjection.js
diff --git a/jstests/error2.js b/jstests/core/error2.js
index 8c27d6250e1..8c27d6250e1 100644
--- a/jstests/error2.js
+++ b/jstests/core/error2.js
diff --git a/jstests/error5.js b/jstests/core/error5.js
index 5884d20d8c1..5884d20d8c1 100644
--- a/jstests/error5.js
+++ b/jstests/core/error5.js
diff --git a/jstests/eval0.js b/jstests/core/eval0.js
index 4375cace839..4375cace839 100644
--- a/jstests/eval0.js
+++ b/jstests/core/eval0.js
diff --git a/jstests/eval1.js b/jstests/core/eval1.js
index 4a5ca75f09b..4a5ca75f09b 100644
--- a/jstests/eval1.js
+++ b/jstests/core/eval1.js
diff --git a/jstests/eval2.js b/jstests/core/eval2.js
index 6e39bb4a7bd..6e39bb4a7bd 100644
--- a/jstests/eval2.js
+++ b/jstests/core/eval2.js
diff --git a/jstests/eval3.js b/jstests/core/eval3.js
index 404d4d863b7..404d4d863b7 100644
--- a/jstests/eval3.js
+++ b/jstests/core/eval3.js
diff --git a/jstests/eval4.js b/jstests/core/eval4.js
index 31d6ef0c2a8..31d6ef0c2a8 100644
--- a/jstests/eval4.js
+++ b/jstests/core/eval4.js
diff --git a/jstests/eval5.js b/jstests/core/eval5.js
index a9223a555a6..a9223a555a6 100644
--- a/jstests/eval5.js
+++ b/jstests/core/eval5.js
diff --git a/jstests/eval6.js b/jstests/core/eval6.js
index 5fe096974c6..5fe096974c6 100644
--- a/jstests/eval6.js
+++ b/jstests/core/eval6.js
diff --git a/jstests/eval7.js b/jstests/core/eval7.js
index 45e06af276c..45e06af276c 100644
--- a/jstests/eval7.js
+++ b/jstests/core/eval7.js
diff --git a/jstests/eval8.js b/jstests/core/eval8.js
index 072a890e80a..072a890e80a 100644
--- a/jstests/eval8.js
+++ b/jstests/core/eval8.js
diff --git a/jstests/eval9.js b/jstests/core/eval9.js
index 9c6642901e4..9c6642901e4 100644
--- a/jstests/eval9.js
+++ b/jstests/core/eval9.js
diff --git a/jstests/eval_nolock.js b/jstests/core/eval_nolock.js
index 2ab96a302a5..2ab96a302a5 100644
--- a/jstests/eval_nolock.js
+++ b/jstests/core/eval_nolock.js
diff --git a/jstests/evala.js b/jstests/core/evala.js
index ed72582fbb6..ed72582fbb6 100644
--- a/jstests/evala.js
+++ b/jstests/core/evala.js
diff --git a/jstests/evalb.js b/jstests/core/evalb.js
index 0caae39498b..0caae39498b 100644
--- a/jstests/evalb.js
+++ b/jstests/core/evalb.js
diff --git a/jstests/evalc.js b/jstests/core/evalc.js
index 0320ecd5133..0320ecd5133 100644
--- a/jstests/evalc.js
+++ b/jstests/core/evalc.js
diff --git a/jstests/evald.js b/jstests/core/evald.js
index 77b1f42d52b..7bb0eb825b1 100644
--- a/jstests/evald.js
+++ b/jstests/core/evald.js
@@ -8,7 +8,6 @@ function debug( x ) {
for( i = 0; i < 10; ++i ) {
t.save( {i:i} );
}
-db.getLastError();
function op( ev, where ) {
p = db.currentOp().inprog;
diff --git a/jstests/evale.js b/jstests/core/evale.js
index af5a303f167..af5a303f167 100644
--- a/jstests/evale.js
+++ b/jstests/core/evale.js
diff --git a/jstests/evalf.js b/jstests/core/evalf.js
index 01b7907ba93..01b7907ba93 100644
--- a/jstests/evalf.js
+++ b/jstests/core/evalf.js
diff --git a/jstests/exists.js b/jstests/core/exists.js
index 3f1e904e52f..3f1e904e52f 100644
--- a/jstests/exists.js
+++ b/jstests/core/exists.js
diff --git a/jstests/exists2.js b/jstests/core/exists2.js
index e925c168f50..e925c168f50 100644
--- a/jstests/exists2.js
+++ b/jstests/core/exists2.js
diff --git a/jstests/exists3.js b/jstests/core/exists3.js
index 53a69d6c3bb..53a69d6c3bb 100644
--- a/jstests/exists3.js
+++ b/jstests/core/exists3.js
diff --git a/jstests/exists4.js b/jstests/core/exists4.js
index fb801ed62e9..fb801ed62e9 100644
--- a/jstests/exists4.js
+++ b/jstests/core/exists4.js
diff --git a/jstests/exists5.js b/jstests/core/exists5.js
index a90a94f908f..a90a94f908f 100644
--- a/jstests/exists5.js
+++ b/jstests/core/exists5.js
diff --git a/jstests/exists6.js b/jstests/core/exists6.js
index 2fa4ba85d49..2fa4ba85d49 100644
--- a/jstests/exists6.js
+++ b/jstests/core/exists6.js
diff --git a/jstests/exists7.js b/jstests/core/exists7.js
index 91fd589f30d..91fd589f30d 100644
--- a/jstests/exists7.js
+++ b/jstests/core/exists7.js
diff --git a/jstests/exists8.js b/jstests/core/exists8.js
index ca62ebeb9ab..ca62ebeb9ab 100644
--- a/jstests/exists8.js
+++ b/jstests/core/exists8.js
diff --git a/jstests/exists9.js b/jstests/core/exists9.js
index 66378d1b424..66378d1b424 100644
--- a/jstests/exists9.js
+++ b/jstests/core/exists9.js
diff --git a/jstests/existsa.js b/jstests/core/existsa.js
index 9ef7e9f374c..9ef7e9f374c 100644
--- a/jstests/existsa.js
+++ b/jstests/core/existsa.js
diff --git a/jstests/existsb.js b/jstests/core/existsb.js
index a212be145c0..a212be145c0 100644
--- a/jstests/existsb.js
+++ b/jstests/core/existsb.js
diff --git a/jstests/explain1.js b/jstests/core/explain1.js
index 4c92b102e38..4c92b102e38 100644
--- a/jstests/explain1.js
+++ b/jstests/core/explain1.js
diff --git a/jstests/explain2.js b/jstests/core/explain2.js
index b70ffdc0b1e..b70ffdc0b1e 100644
--- a/jstests/explain2.js
+++ b/jstests/core/explain2.js
diff --git a/jstests/explain3.js b/jstests/core/explain3.js
index 69dcac531b9..c205e57252c 100644
--- a/jstests/explain3.js
+++ b/jstests/core/explain3.js
@@ -7,7 +7,6 @@ t.ensureIndex( {i:1} );
for( var i = 0; i < 10000; ++i ) {
t.save( {i:i,j:0} );
}
-db.getLastError();
s = startParallelShell( "sleep( 20 ); db.jstests_explain3.dropIndex( {i:1} );" );
@@ -21,4 +20,4 @@ try {
s();
// Sanity check to make sure mongod didn't seg fault.
-assert.eq( 10000, t.count() ); \ No newline at end of file
+assert.eq( 10000, t.count() );
diff --git a/jstests/explain4.js b/jstests/core/explain4.js
index d6d3d818a72..d6d3d818a72 100644
--- a/jstests/explain4.js
+++ b/jstests/core/explain4.js
diff --git a/jstests/explain5.js b/jstests/core/explain5.js
index a90f0726317..a90f0726317 100644
--- a/jstests/explain5.js
+++ b/jstests/core/explain5.js
diff --git a/jstests/explain6.js b/jstests/core/explain6.js
index 47d8d2fd731..47d8d2fd731 100644
--- a/jstests/explain6.js
+++ b/jstests/core/explain6.js
diff --git a/jstests/explain7.js b/jstests/core/explain7.js
index df277aaf211..df277aaf211 100644
--- a/jstests/explain7.js
+++ b/jstests/core/explain7.js
diff --git a/jstests/explain8.js b/jstests/core/explain8.js
index fde6adbd8f4..fde6adbd8f4 100644
--- a/jstests/explain8.js
+++ b/jstests/core/explain8.js
diff --git a/jstests/explain9.js b/jstests/core/explain9.js
index 80cab856aa7..80cab856aa7 100644
--- a/jstests/explain9.js
+++ b/jstests/core/explain9.js
diff --git a/jstests/explain_batch_size.js b/jstests/core/explain_batch_size.js
index 65bc1df40d7..65bc1df40d7 100644
--- a/jstests/explain_batch_size.js
+++ b/jstests/core/explain_batch_size.js
diff --git a/jstests/explaina.js b/jstests/core/explaina.js
index 18c237b84c0..18c237b84c0 100644
--- a/jstests/explaina.js
+++ b/jstests/core/explaina.js
diff --git a/jstests/explainb.js b/jstests/core/explainb.js
index ab49a38ca72..ab49a38ca72 100644
--- a/jstests/explainb.js
+++ b/jstests/core/explainb.js
diff --git a/jstests/extent.js b/jstests/core/extent.js
index 47ae868606a..47ae868606a 100644
--- a/jstests/extent.js
+++ b/jstests/core/extent.js
diff --git a/jstests/extent2.js b/jstests/core/extent2.js
index 75bf0d0b1b8..75bf0d0b1b8 100644
--- a/jstests/extent2.js
+++ b/jstests/core/extent2.js
diff --git a/jstests/filemd5.js b/jstests/core/filemd5.js
index 41d03a1bb30..41d03a1bb30 100644
--- a/jstests/filemd5.js
+++ b/jstests/core/filemd5.js
diff --git a/jstests/find1.js b/jstests/core/find1.js
index ed79c3dd2c7..ed79c3dd2c7 100644
--- a/jstests/find1.js
+++ b/jstests/core/find1.js
diff --git a/jstests/find2.js b/jstests/core/find2.js
index f72203419bc..f72203419bc 100644
--- a/jstests/find2.js
+++ b/jstests/core/find2.js
diff --git a/jstests/find3.js b/jstests/core/find3.js
index a5e4b7a4d66..a5e4b7a4d66 100644
--- a/jstests/find3.js
+++ b/jstests/core/find3.js
diff --git a/jstests/find4.js b/jstests/core/find4.js
index 17639d3a684..17639d3a684 100644
--- a/jstests/find4.js
+++ b/jstests/core/find4.js
diff --git a/jstests/find5.js b/jstests/core/find5.js
index b4a2c0f8865..b4a2c0f8865 100644
--- a/jstests/find5.js
+++ b/jstests/core/find5.js
diff --git a/jstests/find6.js b/jstests/core/find6.js
index c4efd3b88d3..c4efd3b88d3 100644
--- a/jstests/find6.js
+++ b/jstests/core/find6.js
diff --git a/jstests/find7.js b/jstests/core/find7.js
index ca4c7d449bf..ca4c7d449bf 100644
--- a/jstests/find7.js
+++ b/jstests/core/find7.js
diff --git a/jstests/find8.js b/jstests/core/find8.js
index 60f66a500e3..60f66a500e3 100644
--- a/jstests/find8.js
+++ b/jstests/core/find8.js
diff --git a/jstests/find9.js b/jstests/core/find9.js
index 85adf93cc98..85adf93cc98 100644
--- a/jstests/find9.js
+++ b/jstests/core/find9.js
diff --git a/jstests/find_and_modify.js b/jstests/core/find_and_modify.js
index a80859ab60c..a80859ab60c 100644
--- a/jstests/find_and_modify.js
+++ b/jstests/core/find_and_modify.js
diff --git a/jstests/find_and_modify2.js b/jstests/core/find_and_modify2.js
index 2c8ab5b3bb6..2c8ab5b3bb6 100644
--- a/jstests/find_and_modify2.js
+++ b/jstests/core/find_and_modify2.js
diff --git a/jstests/find_and_modify3.js b/jstests/core/find_and_modify3.js
index 4214dfbcd0a..4214dfbcd0a 100644
--- a/jstests/find_and_modify3.js
+++ b/jstests/core/find_and_modify3.js
diff --git a/jstests/find_and_modify4.js b/jstests/core/find_and_modify4.js
index 04abc2f1ce7..04abc2f1ce7 100644
--- a/jstests/find_and_modify4.js
+++ b/jstests/core/find_and_modify4.js
diff --git a/jstests/find_and_modify_server6226.js b/jstests/core/find_and_modify_server6226.js
index a44cb59cb05..a44cb59cb05 100644
--- a/jstests/find_and_modify_server6226.js
+++ b/jstests/core/find_and_modify_server6226.js
diff --git a/jstests/find_and_modify_server6254.js b/jstests/core/find_and_modify_server6254.js
index 7c7c340b7ed..7c7c340b7ed 100644
--- a/jstests/find_and_modify_server6254.js
+++ b/jstests/core/find_and_modify_server6254.js
diff --git a/jstests/find_and_modify_server6582.js b/jstests/core/find_and_modify_server6582.js
index 88ce5a7c4f4..88ce5a7c4f4 100644
--- a/jstests/find_and_modify_server6582.js
+++ b/jstests/core/find_and_modify_server6582.js
diff --git a/jstests/find_and_modify_server6588.js b/jstests/core/find_and_modify_server6588.js
index a21855f5c38..a21855f5c38 100644
--- a/jstests/find_and_modify_server6588.js
+++ b/jstests/core/find_and_modify_server6588.js
diff --git a/jstests/find_and_modify_server6659.js b/jstests/core/find_and_modify_server6659.js
index 7a0419cc72b..7a0419cc72b 100644
--- a/jstests/find_and_modify_server6659.js
+++ b/jstests/core/find_and_modify_server6659.js
diff --git a/jstests/find_and_modify_server6909.js b/jstests/core/find_and_modify_server6909.js
index 2f688459698..2f688459698 100644
--- a/jstests/find_and_modify_server6909.js
+++ b/jstests/core/find_and_modify_server6909.js
diff --git a/jstests/find_and_modify_server6993.js b/jstests/core/find_and_modify_server6993.js
index b8a31915372..b8a31915372 100644
--- a/jstests/find_and_modify_server6993.js
+++ b/jstests/core/find_and_modify_server6993.js
diff --git a/jstests/find_and_modify_server7660.js b/jstests/core/find_and_modify_server7660.js
index cae50d17dcc..cae50d17dcc 100644
--- a/jstests/find_and_modify_server7660.js
+++ b/jstests/core/find_and_modify_server7660.js
diff --git a/jstests/find_and_modify_where.js b/jstests/core/find_and_modify_where.js
index 2092dc5566f..2092dc5566f 100644
--- a/jstests/find_and_modify_where.js
+++ b/jstests/core/find_and_modify_where.js
diff --git a/jstests/find_dedup.js b/jstests/core/find_dedup.js
index 401384ceb7a..401384ceb7a 100644
--- a/jstests/find_dedup.js
+++ b/jstests/core/find_dedup.js
diff --git a/jstests/find_size.js b/jstests/core/find_size.js
index d5a93d59cd2..d5a93d59cd2 100644
--- a/jstests/find_size.js
+++ b/jstests/core/find_size.js
diff --git a/jstests/finda.js b/jstests/core/finda.js
index cf717d5b929..cf717d5b929 100644
--- a/jstests/finda.js
+++ b/jstests/core/finda.js
diff --git a/jstests/fm1.js b/jstests/core/fm1.js
index bc60a3d8911..bc60a3d8911 100644
--- a/jstests/fm1.js
+++ b/jstests/core/fm1.js
diff --git a/jstests/fm2.js b/jstests/core/fm2.js
index 00ccdf4afee..00ccdf4afee 100644
--- a/jstests/fm2.js
+++ b/jstests/core/fm2.js
diff --git a/jstests/fm3.js b/jstests/core/fm3.js
index 8ccde6d5ab3..8ccde6d5ab3 100644
--- a/jstests/fm3.js
+++ b/jstests/core/fm3.js
diff --git a/jstests/fm4.js b/jstests/core/fm4.js
index 1ce947ad5e7..1ce947ad5e7 100644
--- a/jstests/fm4.js
+++ b/jstests/core/fm4.js
diff --git a/jstests/fsync.js b/jstests/core/fsync.js
index 0cfece75c10..9238c992466 100644
--- a/jstests/fsync.js
+++ b/jstests/core/fsync.js
@@ -15,7 +15,6 @@ assert( db.currentOp().fsyncLock == null, "A2" );
// make sure the db is unlocked
db.jstests_fsync.insert({x:1});
-db.getLastError();
assert( db.currentOp().fsyncLock == null, "A" );
diff --git a/jstests/fts1.js b/jstests/core/fts1.js
index 6bd138d6c25..6bd138d6c25 100644
--- a/jstests/fts1.js
+++ b/jstests/core/fts1.js
diff --git a/jstests/fts2.js b/jstests/core/fts2.js
index e0e7469fa5e..e0e7469fa5e 100644
--- a/jstests/fts2.js
+++ b/jstests/core/fts2.js
diff --git a/jstests/fts3.js b/jstests/core/fts3.js
index f5f72c4df0a..f5f72c4df0a 100644
--- a/jstests/fts3.js
+++ b/jstests/core/fts3.js
diff --git a/jstests/fts4.js b/jstests/core/fts4.js
index 8598457b033..8598457b033 100644
--- a/jstests/fts4.js
+++ b/jstests/core/fts4.js
diff --git a/jstests/fts5.js b/jstests/core/fts5.js
index a3097b47a4a..a3097b47a4a 100644
--- a/jstests/fts5.js
+++ b/jstests/core/fts5.js
diff --git a/jstests/fts_blog.js b/jstests/core/fts_blog.js
index 38cbb826eff..38cbb826eff 100644
--- a/jstests/fts_blog.js
+++ b/jstests/core/fts_blog.js
diff --git a/jstests/fts_blogwild.js b/jstests/core/fts_blogwild.js
index ecad0ce0b19..ecad0ce0b19 100644
--- a/jstests/fts_blogwild.js
+++ b/jstests/core/fts_blogwild.js
diff --git a/jstests/fts_enabled.js b/jstests/core/fts_enabled.js
index 8617caff59f..8617caff59f 100644
--- a/jstests/fts_enabled.js
+++ b/jstests/core/fts_enabled.js
diff --git a/jstests/fts_explain.js b/jstests/core/fts_explain.js
index 0d9c1fd7a9d..0d9c1fd7a9d 100644
--- a/jstests/fts_explain.js
+++ b/jstests/core/fts_explain.js
diff --git a/jstests/fts_index.js b/jstests/core/fts_index.js
index 480bfb05fa2..ab1971816bd 100644
--- a/jstests/fts_index.js
+++ b/jstests/core/fts_index.js
@@ -14,26 +14,22 @@ coll.getDB().createCollection(coll.getName());
//
// Spec passes text-specific index validation.
-coll.ensureIndex({a: "text"}, {name: indexName, default_language: "spanish"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: "text"}, {name: indexName, default_language: "spanish"}));
assert.eq(1, coll.getDB().system.indexes.count({ns: coll.getFullName(), name: indexName}));
coll.dropIndexes();
// Spec fails text-specific index validation ("spanglish" unrecognized).
-coll.ensureIndex({a: "text"}, {name: indexName, default_language: "spanglish"});
-assert(db.getLastError());
+assert.writeError(coll.ensureIndex({a: "text"}, {name: indexName, default_language: "spanglish"}));
assert.eq(0, coll.system.indexes.count({ns: coll.getFullName(), name: indexName}));
coll.dropIndexes();
// Spec passes general index validation.
-coll.ensureIndex({"$**": "text"}, {name: indexName});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({"$**": "text"}, {name: indexName}));
assert.eq(1, coll.getDB().system.indexes.count({ns: coll.getFullName(), name: indexName}));
coll.dropIndexes();
// Spec fails general index validation ("a.$**" invalid field name for key).
-coll.ensureIndex({"a.$**": "text"}, {name: indexName});
-assert(db.getLastError());
+assert.writeError(coll.ensureIndex({"a.$**": "text"}, {name: indexName}));
assert.eq(0, coll.getDB().system.indexes.count({ns: coll.getFullName(), name: indexName}));
coll.dropIndexes();
@@ -44,77 +40,54 @@ coll.dropIndexes();
// Can create a text index on a collection where no documents have invalid language_override.
coll.insert({a: ""});
coll.insert({a: "", language: "spanish"});
-coll.ensureIndex({a: "text"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: "text"}));
coll.drop();
// Can't create a text index on a collection containing document with an invalid language_override.
coll.insert({a: "", language: "spanglish"});
-coll.ensureIndex({a: "text"});
-assert(db.getLastError());
+assert.writeError(coll.ensureIndex({a: "text"}));
coll.drop();
// Can insert documents with valid language_override into text-indexed collection.
-coll.ensureIndex({a: "text"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: "text"}));
coll.insert({a: ""});
-coll.insert({a: "", language: "spanish"});
-assert(!db.getLastError());
+assert.writeOK( coll.insert({a: "", language: "spanish"}));
coll.drop();
// Can't insert documents with invalid language_override into text-indexed collection.
-coll.ensureIndex({a: "text"});
-assert(!db.getLastError());
-coll.insert({a: "", language: "spanglish"});
-assert(db.getLastError());
+assert.writeOK(coll.ensureIndex({a: "text"}));
+assert.writeError( coll.insert({a: "", language: "spanglish"}));
coll.drop();
//
// 3. Collections may have at most one text index.
//
-
-coll.ensureIndex({a: 1, b: "text", c: 1});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, b: "text", c: 1}));
assert.eq(2, coll.getIndexes().length);
// ensureIndex() becomes a no-op on an equivalent index spec.
-coll.ensureIndex({a: 1, b: "text", c: 1});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, b: "text", c: 1}));
assert.eq(2, coll.getIndexes().length);
-coll.ensureIndex({a: 1, _fts: "text", _ftsx: 1, c: 1}, {weights: {b: 1}});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, _fts: "text", _ftsx: 1, c: 1}, {weights: {b: 1}}));
assert.eq(2, coll.getIndexes().length);
-coll.ensureIndex({a: 1, b: "text", c: 1}, {default_language: "english"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, b: "text", c: 1}, {default_language: "english"}));
assert.eq(2, coll.getIndexes().length);
-coll.ensureIndex({a: 1, b: "text", c: 1}, {textIndexVersion: 2});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, b: "text", c: 1}, {textIndexVersion: 2}));
assert.eq(2, coll.getIndexes().length);
-coll.ensureIndex({a: 1, b: "text", c: 1}, {language_override: "language"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: 1, b: "text", c: 1}, {language_override: "language"}));
assert.eq(2, coll.getIndexes().length);
// ensureIndex() fails if a second text index would be built.
-coll.ensureIndex({a: 1, _fts: "text", _ftsx: 1, c: 1}, {weights: {d: 1}});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text", c: 1}, {default_language: "none"});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text", c: 1}, {textIndexVersion: 1});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text", c: 1}, {language_override: "idioma"});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text", c: 1}, {weights: {d: 1}});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text", d: 1});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, d: "text", c: 1});
-assert(db.getLastError());
-coll.ensureIndex({b: "text"});
-assert(db.getLastError());
-coll.ensureIndex({b: "text", c: 1});
-assert(db.getLastError());
-coll.ensureIndex({a: 1, b: "text"});
-assert(db.getLastError());
+assert.writeError(coll.ensureIndex({a: 1, _fts: "text", _ftsx: 1, c: 1}, {weights: {d: 1}}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text", c: 1}, {default_language: "none"}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text", c: 1}, {textIndexVersion: 1}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text", c: 1}, {language_override: "idioma"}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text", c: 1}, {weights: {d: 1}}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text", d: 1}));
+assert.writeError(coll.ensureIndex({a: 1, d: "text", c: 1}));
+assert.writeError(coll.ensureIndex({b: "text"}));
+assert.writeError(coll.ensureIndex({b: "text", c: 1}));
+assert.writeError(coll.ensureIndex({a: 1, b: "text"}));
coll.dropIndexes();
@@ -122,8 +95,7 @@ coll.dropIndexes();
// 4. Text indexes properly handle large keys.
//
-coll.ensureIndex({a: "text"});
-assert(!db.getLastError());
+assert.writeOK(coll.ensureIndex({a: "text"}));
var longstring = "";
var longstring2 = "";
diff --git a/jstests/fts_mix.js b/jstests/core/fts_mix.js
index 56da123cdc3..56da123cdc3 100644
--- a/jstests/fts_mix.js
+++ b/jstests/core/fts_mix.js
diff --git a/jstests/fts_partition1.js b/jstests/core/fts_partition1.js
index f1b4c437c3c..f1b4c437c3c 100644
--- a/jstests/fts_partition1.js
+++ b/jstests/core/fts_partition1.js
diff --git a/jstests/core/fts_partition_no_multikey.js b/jstests/core/fts_partition_no_multikey.js
new file mode 100644
index 00000000000..29b9c371612
--- /dev/null
+++ b/jstests/core/fts_partition_no_multikey.js
@@ -0,0 +1,13 @@
+
+t = db.fts_partition_no_multikey;
+t.drop();
+
+t.ensureIndex( { x : 1, y : "text" } )
+
+assert.writeOK( t.insert( { x : 5 , y : "this is fun" } ));
+
+assert.writeError( t.insert( { x : [] , y : "this is fun" } ));
+
+assert.writeError( t.insert( { x : [1] , y : "this is fun" } ));
+
+assert.writeError( t.insert( { x : [1,2] , y : "this is fun" } ));
diff --git a/jstests/fts_phrase.js b/jstests/core/fts_phrase.js
index 0b58bef817e..0b58bef817e 100644
--- a/jstests/fts_phrase.js
+++ b/jstests/core/fts_phrase.js
diff --git a/jstests/fts_proj.js b/jstests/core/fts_proj.js
index 1ecc6688d1b..1ecc6688d1b 100644
--- a/jstests/fts_proj.js
+++ b/jstests/core/fts_proj.js
diff --git a/jstests/fts_projection.js b/jstests/core/fts_projection.js
index 9bdb9dbca8a..9bdb9dbca8a 100644
--- a/jstests/fts_projection.js
+++ b/jstests/core/fts_projection.js
diff --git a/jstests/fts_querylang.js b/jstests/core/fts_querylang.js
index 2a139f5b766..2a139f5b766 100644
--- a/jstests/fts_querylang.js
+++ b/jstests/core/fts_querylang.js
diff --git a/jstests/fts_score_sort.js b/jstests/core/fts_score_sort.js
index 59fb852a774..59fb852a774 100644
--- a/jstests/fts_score_sort.js
+++ b/jstests/core/fts_score_sort.js
diff --git a/jstests/fts_spanish.js b/jstests/core/fts_spanish.js
index cdf73343b5f..b322c369f3f 100644
--- a/jstests/fts_spanish.js
+++ b/jstests/core/fts_spanish.js
@@ -23,9 +23,8 @@ assert.eq( [4], queryIDS( t, "stemmed", null, { language : "en" } ) );
assert.eq( [1,2], queryIDS( t, "prueba" ) );
-t.save( { _id: 5, language: "spanglish", title: "", text: "" } );
-assert( db.getLastError() );
+assert.writeError( t.save( { _id: 5, language: "spanglish", title: "", text: "" } ));
t.dropIndexes();
-t.ensureIndex( { "title": "text", text: "text" }, { default_language: "spanglish" } );
-assert( db.getLastError() );
+res = t.ensureIndex( { "title": "text", text: "text" }, { default_language: "spanglish" } );
+assert.neq(null, res);
diff --git a/jstests/geo1.js b/jstests/core/geo1.js
index 338d96eb23c..5e28713d581 100644
--- a/jstests/geo1.js
+++ b/jstests/core/geo1.js
@@ -6,8 +6,7 @@ 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 : "94061" , loc : [ 37.463911 , 122.23396 ] } )
-assert.isnull( db.getLastError() )
+assert.writeOK( t.insert( { zip : "94061" , loc : [ 37.463911 , 122.23396 ] } ));
// test "2d" has to be first
assert.eq( 1 , t.getIndexKeys().length , "S1" );
@@ -18,8 +17,7 @@ t.ensureIndex( idx );
assert.eq( 2 , t.getIndexKeys().length , "S3" );
assert.eq( 3 , t.count() , "B1" );
-t.insert( { loc : [ 200 , 200 ] } )
-assert( db.getLastError() , "B2" )
+assert.writeError( t.insert( { loc : [ 200 , 200 ] } ));
assert.eq( 3 , t.count() , "B3" );
// test normal access
@@ -36,6 +34,4 @@ assert.eq( "06525" , t.find( { loc : wb.loc } )[0].zip , "C3" )
t.drop();
t.ensureIndex( { loc : "2d" } , { min : -500 , max : 500 , bits : 4 } );
-t.insert( { loc : [ 200 , 200 ] } )
-assert.isnull( db.getLastError() , "D1" )
-
+assert.writeOK( t.insert( { loc : [ 200 , 200 ] } ));
diff --git a/jstests/core/geo10.js b/jstests/core/geo10.js
new file mode 100644
index 00000000000..b122da99f2a
--- /dev/null
+++ b/jstests/core/geo10.js
@@ -0,0 +1,15 @@
+// Test for SERVER-2746
+
+coll = db.geo10
+coll.drop();
+
+assert.writeOK( db.geo10.ensureIndex( { c : '2d', t : 1 }, { min : 0, max : Math.pow( 2, 40 ) } ));
+assert( db.system.indexes.count({ ns : "test.geo10" }) == 2, "A3" )
+
+printjson( db.system.indexes.find().toArray() )
+
+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() )
diff --git a/jstests/geo2.js b/jstests/core/geo2.js
index f9632ebd16d..f9632ebd16d 100644
--- a/jstests/geo2.js
+++ b/jstests/core/geo2.js
diff --git a/jstests/geo3.js b/jstests/core/geo3.js
index 47637783f5b..47637783f5b 100644
--- a/jstests/geo3.js
+++ b/jstests/core/geo3.js
diff --git a/jstests/core/geo4.js b/jstests/core/geo4.js
new file mode 100644
index 00000000000..c1be468bb52
--- /dev/null
+++ b/jstests/core/geo4.js
@@ -0,0 +1,11 @@
+var t = db.geo4;
+t.drop();
+
+t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } );
+
+var err = t.ensureIndex( { loc : "2d" }, { bits : 33 } );
+assert.writeError(err);
+assert( err.getWriteError().errmsg.indexOf("bits in geo index must be between 1 and 32") >= 0,
+ tojson( err ));
+
+assert.writeOK(t.ensureIndex( { loc : "2d" }, { bits : 32 } ));
diff --git a/jstests/geo5.js b/jstests/core/geo5.js
index 67b00f85b44..67b00f85b44 100644
--- a/jstests/geo5.js
+++ b/jstests/core/geo5.js
diff --git a/jstests/geo6.js b/jstests/core/geo6.js
index 185795c57ba..185795c57ba 100644
--- a/jstests/geo6.js
+++ b/jstests/core/geo6.js
diff --git a/jstests/geo7.js b/jstests/core/geo7.js
index c220da54249..c220da54249 100644
--- a/jstests/geo7.js
+++ b/jstests/core/geo7.js
diff --git a/jstests/geo8.js b/jstests/core/geo8.js
index 301f3bcc0d1..301f3bcc0d1 100644
--- a/jstests/geo8.js
+++ b/jstests/core/geo8.js
diff --git a/jstests/geo9.js b/jstests/core/geo9.js
index 8b6510f03b5..8b6510f03b5 100644
--- a/jstests/geo9.js
+++ b/jstests/core/geo9.js
diff --git a/jstests/geo_2d_explain.js b/jstests/core/geo_2d_explain.js
index 8195642aabc..8195642aabc 100644
--- a/jstests/geo_2d_explain.js
+++ b/jstests/core/geo_2d_explain.js
diff --git a/jstests/geo_2d_with_geojson_point.js b/jstests/core/geo_2d_with_geojson_point.js
index b5afc8b77b8..b5afc8b77b8 100644
--- a/jstests/geo_2d_with_geojson_point.js
+++ b/jstests/core/geo_2d_with_geojson_point.js
diff --git a/jstests/geo_allowedcomparisons.js b/jstests/core/geo_allowedcomparisons.js
index 171178d0c7b..61eb3f43e52 100644
--- a/jstests/geo_allowedcomparisons.js
+++ b/jstests/core/geo_allowedcomparisons.js
@@ -24,21 +24,15 @@ oldCenter = [[0, 0], 1];
t.drop();
t.ensureIndex({geo: "2d"});
// 2d doesn't know what to do w/this
-t.insert({geo: geojsonPoint});
-assert(db.getLastError());
+assert.writeError(t.insert({geo: geojsonPoint}));
// Old points are OK.
-t.insert({geo: oldPoint})
-assert(!db.getLastError());
+assert.writeOK(t.insert({geo: oldPoint}));
// Lines not OK in 2d
-t.insert({geo: geojsonLine})
-assert(db.getLastError())
+assert.writeError(t.insert({geo: geojsonLine}));
// Shapes are not OK to insert in 2d
-t.insert({geo: geojsonPoly})
-assert(db.getLastError());
-t.insert({geo: oldCenterSphere})
-assert(db.getLastError());
-t.insert({geo: oldCenter})
-assert(db.getLastError());
+assert.writeError(t.insert({geo: geojsonPoly}));
+assert.writeError(t.insert({geo: oldCenterSphere}));
+assert.writeError(t.insert({geo: oldCenter}));
// If we try to insert a polygon, it thinks it's an array of points. Let's not
// do that. Ditto for the box.
@@ -89,19 +83,13 @@ t.dropIndex({geo: "2d"})
runTests();
// 2dsphere index now.
-t.ensureIndex({geo: "2dsphere"})
-assert(!db.getLastError())
+assert.writeOK( t.ensureIndex({geo: "2dsphere"}) );
// 2dsphere does not support arrays of points.
-t.insert({geo: [geojsonPoint2, geojsonPoint]})
-assert(db.getLastError())
+assert.writeError(t.insert({geo: [geojsonPoint2, geojsonPoint]}));
runTests();
// Old stuff is not GeoJSON (or old-style point). All should fail.
-t.insert({geo: oldBox})
-assert(db.getLastError())
-t.insert({geo: oldPolygon})
-assert(db.getLastError())
-t.insert({geo: oldCenter})
-assert(db.getLastError())
-t.insert({geo: oldCenterSphere})
-assert(db.getLastError())
+assert.writeError(t.insert({geo: oldBox}));
+assert.writeError(t.insert({geo: oldPolygon}));
+assert.writeError(t.insert({geo: oldCenter}));
+assert.writeError(t.insert({geo: oldCenterSphere}));
diff --git a/jstests/geo_array0.js b/jstests/core/geo_array0.js
index 5fe46781d1d..39c7b10c083 100644
--- a/jstests/geo_array0.js
+++ b/jstests/core/geo_array0.js
@@ -5,17 +5,16 @@ function test(index) {
t.drop();
t.insert( { zip : "10001", loc : { home : [ 10, 10 ], work : [ 50, 50 ] } } )
t.insert( { zip : "10002", loc : { home : [ 20, 20 ], work : [ 50, 50 ] } } )
- t.insert( { zip : "10003", loc : { home : [ 30, 30 ], work : [ 50, 50 ] } } )
- assert.isnull( db.getLastError() )
+ var res = t.insert( { zip : "10003", loc : { home : [ 30, 30 ], work : [ 50, 50 ] } } );
+ assert.writeOK( res );
if (index) {
- t.ensureIndex( { loc : "2d", zip : 1 } );
- assert.isnull( db.getLastError() )
+ assert.writeOK(t.ensureIndex( { loc : "2d", zip : 1 } ));
assert.eq( 2, t.getIndexKeys().length )
}
- t.insert( { zip : "10004", loc : { home : [ 40, 40 ], work : [ 50, 50 ] } } )
- assert.isnull( db.getLastError() )
+ res = t.insert( { zip : "10004", loc : { home : [ 40, 40 ], work : [ 50, 50 ] } } );
+ assert.writeOK( res );
// test normal access
printjson( t.find( { loc : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() )
diff --git a/jstests/geo_array1.js b/jstests/core/geo_array1.js
index ca61050c888..ca61050c888 100644
--- a/jstests/geo_array1.js
+++ b/jstests/core/geo_array1.js
diff --git a/jstests/geo_array2.js b/jstests/core/geo_array2.js
index 0e8d57dd855..acfc6a15abf 100644
--- a/jstests/geo_array2.js
+++ b/jstests/core/geo_array2.js
@@ -26,9 +26,7 @@ for( var i = -1; i < 2; i++ ){
}
}
-t.ensureIndex({ loc : "2d" , type : 1 })
-
-assert.isnull( db.getLastError() )
+assert.writeOK(t.ensureIndex({ loc : "2d" , type : 1 }));
print( "Starting testing phase... ")
diff --git a/jstests/geo_borders.js b/jstests/core/geo_borders.js
index 953850ad7f3..20781409b1e 100644
--- a/jstests/geo_borders.js
+++ b/jstests/core/geo_borders.js
@@ -20,12 +20,14 @@ overallMin = -1
overallMax = 1
// Create a point index slightly smaller than the points we have
-t.ensureIndex( { loc : "2d" }, { max : overallMax - epsilon / 2, min : overallMin + epsilon / 2 } )
-assert( db.getLastError() )
+var res = t.ensureIndex({ loc: "2d" },
+ { max: overallMax - epsilon / 2,
+ min: overallMin + epsilon / 2 });
+assert.neq(null, res);
// Create a point index only slightly bigger than the points we have
-t.ensureIndex( { loc : "2d" }, { max : overallMax + epsilon, min : overallMin - epsilon } )
-assert.isnull( db.getLastError() )
+res = t.ensureIndex( { loc : "2d" }, { max : overallMax + epsilon, min : overallMin - epsilon } );
+assert.writeOK(res);
// ************
// Box Tests
@@ -150,18 +152,10 @@ assert.eq( overallMax, db.runCommand( { geoNear : "borders", near : offCenter }
assert.eq( overallMin, db.runCommand( { geoNear : "borders", near : onBoundsNeg } ).results[0].obj.loc.y );
// Make sure we can't get all nearby points to point over boundary
-try {
- db.runCommand( { geoNear : "borders", near : offBounds } ).results.length
- assert( false )
-} catch (e) {
-}
+assert.commandFailed( db.runCommand( { geoNear : "borders", near : offBounds } ));
// Make sure we can't get all nearby points to point on max boundary
-try {
- db.runCommand( { geoNear : "borders", near : onBounds } ).results.length
- assert( false )
-} catch (e) {
-}
+assert.commandWorked( db.runCommand( { geoNear : "borders", near : onBounds } ));
// Make sure we can get all nearby points within one step (4 points in top
// corner)
diff --git a/jstests/geo_box1.js b/jstests/core/geo_box1.js
index 5ef335158e1..5ef335158e1 100644
--- a/jstests/geo_box1.js
+++ b/jstests/core/geo_box1.js
diff --git a/jstests/geo_box1_noindex.js b/jstests/core/geo_box1_noindex.js
index 8c1ae87e08e..8c1ae87e08e 100644
--- a/jstests/geo_box1_noindex.js
+++ b/jstests/core/geo_box1_noindex.js
diff --git a/jstests/geo_box2.js b/jstests/core/geo_box2.js
index 4905a6cda8d..4905a6cda8d 100644
--- a/jstests/geo_box2.js
+++ b/jstests/core/geo_box2.js
diff --git a/jstests/geo_box3.js b/jstests/core/geo_box3.js
index 8941f637518..8941f637518 100644
--- a/jstests/geo_box3.js
+++ b/jstests/core/geo_box3.js
diff --git a/jstests/geo_center_sphere1.js b/jstests/core/geo_center_sphere1.js
index 9f5eaec8764..4e4a658f058 100644
--- a/jstests/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 = 3 // 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
@@ -22,10 +22,11 @@ function test(index) {
num = 0;
+ var bulk = t.initializeUnorderedBulkOp();
for ( x=-179; x<=179; x += skip ){
for ( y=-89; y<=89; y += skip ){
o = { _id : num++ , loc : [ x , y ] }
- t.save( o )
+ bulk.insert( o );
for ( i=0; i<searches.length; i++ ){
if ( Geo.sphereDistance( [ x , y ] , searches[i][0] ) <= searches[i][1])
correct[i].push( o );
@@ -33,6 +34,7 @@ function test(index) {
}
gc(); // needed with low skip values
}
+ assert.writeOK(bulk.execute());
if (index) {
t.ensureIndex( { loc : index } );
diff --git a/jstests/core/geo_center_sphere2.js b/jstests/core/geo_center_sphere2.js
new file mode 100644
index 00000000000..8cb77a44c09
--- /dev/null
+++ b/jstests/core/geo_center_sphere2.js
@@ -0,0 +1,160 @@
+//
+// Tests the error handling of spherical queries
+// along with multi-location documents.
+// This is necessary since the error handling must manage
+// multiple documents, and so requires simultaneous testing.
+//
+
+function deg2rad(arg) { return arg * Math.PI / 180.0; }
+function rad2deg(arg) { return arg * 180.0 / Math.PI; }
+
+function computexscandist(y, maxDistDegrees) {
+ return maxDistDegrees / Math.min(Math.cos(deg2rad(Math.min(89.0, y + maxDistDegrees))),
+ Math.cos(deg2rad(Math.max(-89.0, y - maxDistDegrees))));
+}
+
+function pointIsOK(startPoint, radius) {
+ yscandist = rad2deg(radius) + 0.01;
+ xscandist = computexscandist(startPoint[1], yscandist);
+ return (startPoint[0] + xscandist < 180)
+ && (startPoint[0] - xscandist > -180)
+ && (startPoint[1] + yscandist < 90)
+ && (startPoint[1] - yscandist > -90);
+}
+
+var numTests = 30;
+
+for ( var test = 0; test < numTests; test++ ) {
+ Random.srand( 1337 + test );
+
+ var radius = 5000 * Random.rand(); // km
+ radius = radius / 6371; // radians;
+ var numDocs = Math.floor( 400 * Random.rand() );
+ // TODO: Wrapping uses the error value to figure out what would overlap...
+ var bits = Math.floor( 5 + Random.rand() * 28 );
+ var maxPointsPerDoc = 50;
+
+ var t = db.sphere;
+
+ var randomPoint = function() {
+ return [ Random.rand() * 360 - 180, Random.rand() * 180 - 90 ];
+ };
+
+ // Get a start point that doesn't require wrapping
+ // TODO: Are we a bit too aggressive with wrapping issues?
+ var startPoint;
+ var ex = null;
+ do {
+ t.drop();
+ startPoint = randomPoint();
+ t.ensureIndex( { loc : "2d" }, { bits : bits } );
+ } while (!pointIsOK(startPoint, radius))
+
+ var pointsIn = 0;
+ var pointsOut = 0;
+ var docsIn = 0;
+ var docsOut = 0;
+ var totalPoints = 0;
+
+ var bulk = t.initializeUnorderedBulkOp();
+ for ( var i = 0; i < numDocs; i++ ) {
+
+ var numPoints = Math.floor( Random.rand() * maxPointsPerDoc + 1 );
+ var docIn = false;
+ var multiPoint = [];
+
+ totalPoints += numPoints;
+
+ for ( var p = 0; p < numPoints; p++ ) {
+ var point = randomPoint();
+ multiPoint.push( point );
+
+ if ( Geo.sphereDistance( startPoint, point ) <= radius ) {
+ pointsIn++;
+ docIn = true;
+ } else {
+ pointsOut++;
+ }
+ }
+
+ bulk.insert( { loc : multiPoint } );
+
+ if ( docIn )
+ docsIn++;
+ else
+ docsOut++;
+
+ }
+
+ printjson( { test: test, radius : radius, bits : bits, numDocs : numDocs,
+ pointsIn : pointsIn, docsIn : docsIn, pointsOut : pointsOut,
+ docsOut : docsOut } );
+
+ assert.writeOK(bulk.execute());
+ assert.eq( docsIn + docsOut, numDocs );
+ assert.eq( pointsIn + pointsOut, totalPoints );
+
+ // $centerSphere
+ assert.eq( docsIn, t.find({ loc: { $within:
+ { $centerSphere: [ startPoint, radius ]}}} ).count() );
+
+ // $nearSphere
+ var cursor = t.find({ loc: { $nearSphere: startPoint, $maxDistance: radius }});
+ var results = cursor.limit( 2 * pointsIn ).toArray();
+
+ assert.eq( docsIn, results.length );
+
+ var distance = 0;
+ for ( var i = 0; i < results.length; i++ ) {
+ var minNewDistance = radius + 1;
+ for( var j = 0; j < results[i].loc.length; j++ ){
+ var newDistance = Geo.sphereDistance( startPoint, results[i].loc[j] );
+ if( newDistance < minNewDistance && newDistance >= distance ) {
+ minNewDistance = newDistance;
+ }
+ }
+
+ //print( "Dist from : " + results[i].loc[j] + " to " + startPoint + " is "
+ // + minNewDistance + " vs " + radius )
+
+ assert.lte( minNewDistance, radius );
+ assert.gte( minNewDistance, distance );
+ distance = minNewDistance;
+ }
+
+ // geoNear
+ results = db.runCommand({ geoNear: "sphere", near: startPoint, maxDistance: radius,
+ num : 2 * pointsIn, spherical : true } ).results;
+
+ /*
+ printjson( results );
+
+ for ( var j = 0; j < results[0].obj.loc.length; j++ ) {
+ var newDistance = Geo.sphereDistance( startPoint, results[0].obj.loc[j] )
+ if( newDistance <= radius ) print( results[0].obj.loc[j] + " : " + newDistance )
+ }
+ */
+
+ assert.eq( docsIn, results.length );
+
+ var distance = 0;
+ for ( var i = 0; i < results.length; i++ ) {
+ var retDistance = results[i].dis
+
+ // print( "Dist from : " + results[i].loc + " to " + startPoint + " is "
+ // + retDistance + " vs " + radius )
+
+ var distInObj = false;
+ for ( var j = 0; j < results[i].obj.loc.length && distInObj == false; j++ ) {
+ var newDistance = Geo.sphereDistance( startPoint, results[i].obj.loc[j] );
+ distInObj = ( newDistance >= retDistance - 0.0001 &&
+ newDistance <= retDistance + 0.0001 );
+ }
+
+ assert( distInObj );
+ assert.lte( retDistance, radius );
+ assert.gte( retDistance, distance );
+ distance = retDistance;
+ }
+}
+
diff --git a/jstests/geo_circle1.js b/jstests/core/geo_circle1.js
index 852b60d186b..852b60d186b 100644
--- a/jstests/geo_circle1.js
+++ b/jstests/core/geo_circle1.js
diff --git a/jstests/geo_circle1_noindex.js b/jstests/core/geo_circle1_noindex.js
index 1569174a679..1569174a679 100644
--- a/jstests/geo_circle1_noindex.js
+++ b/jstests/core/geo_circle1_noindex.js
diff --git a/jstests/geo_circle2.js b/jstests/core/geo_circle2.js
index ef76884609c..ef76884609c 100644
--- a/jstests/geo_circle2.js
+++ b/jstests/core/geo_circle2.js
diff --git a/jstests/geo_circle2a.js b/jstests/core/geo_circle2a.js
index 67a6ba17243..67a6ba17243 100644
--- a/jstests/geo_circle2a.js
+++ b/jstests/core/geo_circle2a.js
diff --git a/jstests/geo_circle3.js b/jstests/core/geo_circle3.js
index 2882b47378e..2882b47378e 100644
--- a/jstests/geo_circle3.js
+++ b/jstests/core/geo_circle3.js
diff --git a/jstests/geo_circle4.js b/jstests/core/geo_circle4.js
index dc3c564389e..dc3c564389e 100644
--- a/jstests/geo_circle4.js
+++ b/jstests/core/geo_circle4.js
diff --git a/jstests/geo_circle5.js b/jstests/core/geo_circle5.js
index fea9c56fd02..fea9c56fd02 100644
--- a/jstests/geo_circle5.js
+++ b/jstests/core/geo_circle5.js
diff --git a/jstests/geo_distinct.js b/jstests/core/geo_distinct.js
index 60e0d15d22d..db6806fe747 100644
--- a/jstests/geo_distinct.js
+++ b/jstests/core/geo_distinct.js
@@ -5,12 +5,10 @@ t.drop()
t.save( { _id : ObjectId( "4ce63ec2f360622431000013" ), loc : [ 55.59664, 13.00156 ], author : "FredrikL" } )
-printjson( db.runCommand( { distinct : 'commits', key : 'loc' } ) )
-assert.isnull( db.getLastError() )
+assert.commandWorked( db.runCommand( { distinct : 'commits', key : 'loc' } ) );
t.ensureIndex( { loc : '2d' } )
printjson( t.getIndexes() )
-printjson( db.runCommand( { distinct : 'commits', key : 'loc' } ) )
-assert.isnull( db.getLastError() ) \ No newline at end of file
+assert.commandWorked( db.runCommand( { distinct : 'commits', key : 'loc' } ) );
diff --git a/jstests/geo_exactfetch.js b/jstests/core/geo_exactfetch.js
index c0a0e714eae..c0a0e714eae 100644
--- a/jstests/geo_exactfetch.js
+++ b/jstests/core/geo_exactfetch.js
diff --git a/jstests/geo_fiddly_box.js b/jstests/core/geo_fiddly_box.js
index 95f33a32987..95f33a32987 100644
--- a/jstests/geo_fiddly_box.js
+++ b/jstests/core/geo_fiddly_box.js
diff --git a/jstests/geo_fiddly_box2.js b/jstests/core/geo_fiddly_box2.js
index 0588abfa1de..0588abfa1de 100644
--- a/jstests/geo_fiddly_box2.js
+++ b/jstests/core/geo_fiddly_box2.js
diff --git a/jstests/geo_group.js b/jstests/core/geo_group.js
index 4e038f94b03..32e06890568 100644
--- a/jstests/geo_group.js
+++ b/jstests/core/geo_group.js
@@ -2,11 +2,13 @@ t = db.geo_group;
t.drop();
n = 1;
+var bulk = t.initializeUnorderedBulkOp();
for ( var x=-100; x<100; x+=2 ){
for ( var y=-100; y<100; y+=2 ){
- t.insert( { _id : n++ , loc : [ x , y ] } )
+ bulk.insert( { _id : n++ , loc : [ x , y ] } );
}
}
+assert.writeOK(bulk.execute());
t.ensureIndex( { loc : "2d" } );
diff --git a/jstests/geo_haystack1.js b/jstests/core/geo_haystack1.js
index f4035ecbcf2..f4035ecbcf2 100644
--- a/jstests/geo_haystack1.js
+++ b/jstests/core/geo_haystack1.js
diff --git a/jstests/geo_haystack2.js b/jstests/core/geo_haystack2.js
index 2e0eb5710fb..2e0eb5710fb 100644
--- a/jstests/geo_haystack2.js
+++ b/jstests/core/geo_haystack2.js
diff --git a/jstests/geo_haystack3.js b/jstests/core/geo_haystack3.js
index f5a2ab7becb..f5a2ab7becb 100644
--- a/jstests/geo_haystack3.js
+++ b/jstests/core/geo_haystack3.js
diff --git a/jstests/geo_invalid_polygon.js b/jstests/core/geo_invalid_polygon.js
index af5545b7819..9ccf619dae5 100644
--- a/jstests/geo_invalid_polygon.js
+++ b/jstests/core/geo_invalid_polygon.js
@@ -19,15 +19,11 @@ var geometry = {
};
t.insert({_id: 42, geometry: geometry});
-t.createIndex({geometry: '2dsphere'});
-var gleResult = db.getLastErrorCmd(1);
-
-// Verify that we triggered the error we're trying to test.
-assert.eq(16755, gleResult.code);
+var err = assert.writeError(t.createIndex({geometry: '2dsphere'}));
// Document's _id should be in error message.
assert(
- -1 != gleResult.err.indexOf('42'),
- "Error message didn't contain document _id.\nMessage: \"" + gleResult.err
+ -1 != err.getWriteError().errmsg.indexOf('42'),
+ "Error message didn't contain document _id.\nMessage: \"" + err.errmsg
+ '"\n'
);
diff --git a/jstests/geo_mapreduce.js b/jstests/core/geo_mapreduce.js
index a6ecf763ae1..a6ecf763ae1 100644
--- a/jstests/geo_mapreduce.js
+++ b/jstests/core/geo_mapreduce.js
diff --git a/jstests/geo_mapreduce2.js b/jstests/core/geo_mapreduce2.js
index 9c393457c7b..9c393457c7b 100644
--- a/jstests/geo_mapreduce2.js
+++ b/jstests/core/geo_mapreduce2.js
diff --git a/jstests/geo_max.js b/jstests/core/geo_max.js
index 03932004b75..03932004b75 100644
--- a/jstests/geo_max.js
+++ b/jstests/core/geo_max.js
diff --git a/jstests/geo_mindistance.js b/jstests/core/geo_mindistance.js
index b429eacb708..b429eacb708 100644
--- a/jstests/geo_mindistance.js
+++ b/jstests/core/geo_mindistance.js
diff --git a/jstests/geo_mindistance_boundaries.js b/jstests/core/geo_mindistance_boundaries.js
index 80e933827b6..80e933827b6 100644
--- a/jstests/geo_mindistance_boundaries.js
+++ b/jstests/core/geo_mindistance_boundaries.js
diff --git a/jstests/geo_multikey0.js b/jstests/core/geo_multikey0.js
index 7d0ea57e329..7d0ea57e329 100644
--- a/jstests/geo_multikey0.js
+++ b/jstests/core/geo_multikey0.js
diff --git a/jstests/geo_multikey1.js b/jstests/core/geo_multikey1.js
index 5c949a8599a..ce55609db25 100644
--- a/jstests/geo_multikey1.js
+++ b/jstests/core/geo_multikey1.js
@@ -12,9 +12,8 @@ for( i = 0; i < 10; ++i ) {
t.save( {loc:locArr,a:arr,b:arr,c:arr} );
// Parallel arrays are allowed for geo indexes.
-t.ensureIndex( {loc:'2d',a:1,b:1,c:1} );
-assert( !db.getLastError() );
+assert.writeOK(t.ensureIndex( {loc:'2d',a:1,b:1,c:1} ));
// Parallel arrays are not allowed for normal indexes.
-t.ensureIndex( {loc:1,a:1,b:1,c:1} );
-assert( db.getLastError() );
+assert.writeError(t.ensureIndex( {loc:1,a:1,b:1,c:1} ));
+
diff --git a/jstests/geo_multinest0.js b/jstests/core/geo_multinest0.js
index 68e609550d7..c15eb7d60d7 100644
--- a/jstests/geo_multinest0.js
+++ b/jstests/core/geo_multinest0.js
@@ -7,17 +7,16 @@ t.insert( { zip : "10001", data : [ { loc : [ 10, 10 ], type : "home" },
{ loc : [ 50, 50 ], type : "work" } ] } )
t.insert( { zip : "10002", data : [ { loc : [ 20, 20 ], type : "home" },
{ loc : [ 50, 50 ], type : "work" } ] } )
-t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
-assert.isnull( db.getLastError() )
+var res = t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
+ { loc : [ 50, 50 ], type : "work" } ] } );
+assert.writeOK( res );
-t.ensureIndex( { "data.loc" : "2d", zip : 1 } );
-assert.isnull( db.getLastError() )
+assert.writeOK(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
assert.eq( 2, t.getIndexKeys().length )
-t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
-assert.isnull( db.getLastError() )
+res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
+ { loc : [ 50, 50 ], type : "work" } ] } );
+assert.writeOK( res );
// test normal access
@@ -39,18 +38,16 @@ t.drop();
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" } ] } )
-t.insert( { zip : "10003", data : [ { loc : [ { x : 30, y : 30 }, [ 50, 50 ] ], type : "home" } ] } )
-assert.isnull( db.getLastError() )
+res = t.insert({ zip: "10003", data: [{ loc: [{ x: 30, y: 30 }, [ 50, 50 ]], type: "home" }]});
+assert( !res.hasWriteErrors() );
-t.ensureIndex( { "data.loc" : "2d", zip : 1 } );
-assert.isnull( db.getLastError() )
+assert.writeOK(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
assert.eq( 2, t.getIndexKeys().length )
-t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
- { loc : [ 50, 50 ], type : "work" } ] } )
+res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
+ { loc : [ 50, 50 ], type : "work" } ] } );
-
-assert.isnull( db.getLastError() )
+assert.writeOK( res );
// test normal access
printjson( t.find( { "data.loc" : { $within : { $box : [ [ 0, 0 ], [ 45, 45 ] ] } } } ).toArray() )
diff --git a/jstests/geo_multinest1.js b/jstests/core/geo_multinest1.js
index 703283607d4..478e2ab83e4 100644
--- a/jstests/geo_multinest1.js
+++ b/jstests/core/geo_multinest1.js
@@ -7,17 +7,16 @@ t.insert( { zip : "10001", data : [ { loc : [ 10, 10 ], type : "home" },
{ loc : [ 29, 29 ], type : "work" } ] } )
t.insert( { zip : "10002", data : [ { loc : [ 20, 20 ], type : "home" },
{ loc : [ 39, 39 ], type : "work" } ] } )
-t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
- { loc : [ 49, 49 ], type : "work" } ] } )
-assert.isnull( db.getLastError() )
+var res = t.insert( { zip : "10003", data : [ { loc : [ 30, 30 ], type : "home" },
+ { loc : [ 49, 49 ], type : "work" } ] } );
+assert.writeOK( res );
-t.ensureIndex( { "data.loc" : "2d", zip : 1 } );
-assert.isnull( db.getLastError() )
+assert.writeOK(t.ensureIndex( { "data.loc" : "2d", zip : 1 } ));
assert.eq( 2, t.getIndexKeys().length )
-t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
- { loc : [ 59, 59 ], type : "work" } ] } )
-assert.isnull( db.getLastError() )
+res = t.insert( { zip : "10004", data : [ { loc : [ 40, 40 ], type : "home" },
+ { loc : [ 59, 59 ], type : "work" } ] } );
+assert.writeOK( res );
// test normal access
diff --git a/jstests/geo_near_random1.js b/jstests/core/geo_near_random1.js
index 50539f3ea5d..50539f3ea5d 100644
--- a/jstests/geo_near_random1.js
+++ b/jstests/core/geo_near_random1.js
diff --git a/jstests/geo_near_random2.js b/jstests/core/geo_near_random2.js
index 1673abb88e7..1673abb88e7 100644
--- a/jstests/geo_near_random2.js
+++ b/jstests/core/geo_near_random2.js
diff --git a/jstests/geo_nearwithin.js b/jstests/core/geo_nearwithin.js
index 6f38f5dd7d9..6f38f5dd7d9 100644
--- a/jstests/geo_nearwithin.js
+++ b/jstests/core/geo_nearwithin.js
diff --git a/jstests/geo_or.js b/jstests/core/geo_or.js
index fd9b7234a21..fd9b7234a21 100644
--- a/jstests/geo_or.js
+++ b/jstests/core/geo_or.js
diff --git a/jstests/geo_poly_edge.js b/jstests/core/geo_poly_edge.js
index 31a0849e67d..31a0849e67d 100644
--- a/jstests/geo_poly_edge.js
+++ b/jstests/core/geo_poly_edge.js
diff --git a/jstests/geo_poly_line.js b/jstests/core/geo_poly_line.js
index aca77b6ab0a..aca77b6ab0a 100644
--- a/jstests/geo_poly_line.js
+++ b/jstests/core/geo_poly_line.js
diff --git a/jstests/geo_polygon1.js b/jstests/core/geo_polygon1.js
index 4b7427a4da2..11f17910306 100644
--- a/jstests/geo_polygon1.js
+++ b/jstests/core/geo_polygon1.js
@@ -40,8 +40,7 @@ pacman = [
];
t.save({loc: [1,3] }); // Add a point that's in
-t.ensureIndex( { loc : "2d" } );
-assert.isnull( db.getLastError() )
+assert.writeOK(t.ensureIndex( { loc : "2d" } ));
assert.eq( 1 , t.find({loc : { $within : { $polygon : pacman }}} ).count() , "Pacman single point" );
diff --git a/jstests/geo_polygon1_noindex.js b/jstests/core/geo_polygon1_noindex.js
index 2a94bbbfd09..4fc7135c2f9 100644
--- a/jstests/geo_polygon1_noindex.js
+++ b/jstests/core/geo_polygon1_noindex.js
@@ -35,8 +35,7 @@ pacman = [
[4,0], [2,0] // Bottom
];
-t.save({loc: [1,3] }); // Add a point that's in
-assert.isnull( db.getLastError() )
+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" );
diff --git a/jstests/core/geo_polygon2.js b/jstests/core/geo_polygon2.js
new file mode 100644
index 00000000000..c626064f153
--- /dev/null
+++ b/jstests/core/geo_polygon2.js
@@ -0,0 +1,263 @@
+//
+// More tests for N-dimensional polygon querying
+//
+
+// Create a polygon of some shape (no holes)
+// using turtle graphics. Basically, will look like a very contorted octopus (quad-pus?) shape.
+// There are no holes, but some edges will probably touch.
+
+var numTests = 4;
+
+for ( var test = 0; test < numTests; test++ ) {
+
+ Random.srand( 1337 + test );
+
+ var numTurtles = 4;
+ var gridSize = [ 20, 20 ];
+ var turtleSteps = 500;
+ var bounds = [ Random.rand() * -1000000 + 0.00001, Random.rand() * 1000000 + 0.00001 ];
+ var rotation = Math.PI * Random.rand();
+ var bits = Math.floor( Random.rand() * 32 );
+
+ printjson( { test : test, rotation : rotation, bits : bits });
+
+ var rotatePoint = function( x, y ) {
+
+ if( y == undefined ){
+ y = x[1];
+ x = x[0];
+ }
+
+ xp = x * Math.cos( rotation ) - y * Math.sin( rotation );
+ yp = y * Math.cos( rotation ) + x * Math.sin( rotation );
+
+ var scaleX = (bounds[1] - bounds[0]) / 360;
+ var scaleY = (bounds[1] - bounds[0]) / 360;
+
+ x *= scaleX;
+ y *= scaleY;
+
+ return [xp, yp];
+ };
+
+ var grid = [];
+ for ( var i = 0; i < gridSize[0]; i++ ) {
+ grid.push( new Array( gridSize[1] ) );
+ }
+
+ grid.toString = function() {
+
+ var gridStr = "";
+ for ( var j = grid[0].length - 1; j >= -1; j-- ) {
+ for ( var i = 0; i < grid.length; i++ ) {
+ if ( i == 0 )
+ gridStr += ( j == -1 ? " " : ( j % 10) ) + ": ";
+ if ( j != -1 )
+ gridStr += "[" + ( grid[i][j] != undefined ? grid[i][j] : " " ) + "]";
+ else
+ gridStr += " " + ( i % 10 ) + " ";
+ }
+ gridStr += "\n";
+ }
+
+ return gridStr;
+ };
+
+ var turtles = [];
+ for ( var i = 0; i < numTurtles; i++ ) {
+
+ var up = ( i % 2 == 0 ) ? i - 1 : 0;
+ var left = ( i % 2 == 1 ) ? ( i - 1 ) - 1 : 0;
+
+ turtles[i] = [
+ [ Math.floor( gridSize[0] / 2 ), Math.floor( gridSize[1] / 2 ) ],
+ [ Math.floor( gridSize[0] / 2 ) + left, Math.floor( gridSize[1] / 2 ) + up ] ];
+
+ grid[turtles[i][1][0]][turtles[i][1][1]] = i;
+
+ }
+
+ grid[Math.floor( gridSize[0] / 2 )][Math.floor( gridSize[1] / 2 )] = "S";
+
+ // print( grid.toString() )
+
+ var pickDirections = function() {
+
+ var up = Math.floor( Random.rand() * 3 );
+ if ( up == 2 )
+ up = -1;
+
+ if ( up == 0 ) {
+ var left = Math.floor( Random.rand() * 3 );
+ if ( left == 2 )
+ left = -1;
+ } else
+ left = 0;
+
+ if ( Random.rand() < 0.5 ) {
+ var swap = left;
+ left = up;
+ up = swap;
+ }
+
+ return [ left, up ];
+ };
+
+ for ( var s = 0; s < turtleSteps; s++ ) {
+
+ for ( var t = 0; t < numTurtles; t++ ) {
+
+ var dirs = pickDirections();
+ var up = dirs[0];
+ var left = dirs[1];
+
+ var lastTurtle = turtles[t][turtles[t].length - 1];
+ var nextTurtle = [ lastTurtle[0] + left, lastTurtle[1] + up ];
+
+ if ( nextTurtle[0] >= gridSize[0] ||
+ nextTurtle[1] >= gridSize[1] ||
+ nextTurtle[0] < 0 ||
+ nextTurtle[1] < 0 )
+ continue;
+
+ if ( grid[nextTurtle[0]][nextTurtle[1]] == undefined ) {
+ turtles[t].push( nextTurtle );
+ grid[nextTurtle[0]][nextTurtle[1]] = t;
+ }
+
+ }
+ }
+
+ turtlePaths = [];
+ for ( var t = 0; t < numTurtles; t++ ) {
+
+ turtlePath = [];
+
+ var nextSeg = function(currTurtle, prevTurtle) {
+
+ var pathX = currTurtle[0]
+
+ if ( currTurtle[1] < prevTurtle[1] ) {
+ pathX = currTurtle[0] + 1;
+ pathY = prevTurtle[1]
+ } else if ( currTurtle[1] > prevTurtle[1] ) {
+ pathX = currTurtle[0];
+ pathY = currTurtle[1];
+ } else if ( currTurtle[0] < prevTurtle[0] ) {
+ pathX = prevTurtle[0];
+ pathY = currTurtle[1];
+ } else if ( currTurtle[0] > prevTurtle[0] ) {
+ pathX = currTurtle[0];
+ pathY = currTurtle[1] + 1;
+ }
+
+ // print( " Prev : " + prevTurtle + " Curr : " + currTurtle + " path
+ // : "
+ // + [pathX, pathY]);
+
+ return [ pathX, pathY ]
+ };
+
+ for ( var s = 1; s < turtles[t].length; s++ ) {
+
+ currTurtle = turtles[t][s];
+ prevTurtle = turtles[t][s - 1];
+
+ turtlePath.push( nextSeg( currTurtle, prevTurtle ) );
+
+ }
+
+ for ( var s = turtles[t].length - 2; s >= 0; s-- ) {
+
+ currTurtle = turtles[t][s];
+ prevTurtle = turtles[t][s + 1];
+
+ turtlePath.push( nextSeg( currTurtle, prevTurtle ) );
+
+ }
+
+ // printjson( turtlePath )
+
+ // End of the line is not inside our polygon.
+ var lastTurtle = turtles[t][turtles[t].length - 1];
+ grid[lastTurtle[0]][lastTurtle[1]] = undefined;
+
+ fixedTurtlePath = [];
+ for ( var s = 1; s < turtlePath.length; s++ ) {
+
+ if ( turtlePath[s - 1][0] == turtlePath[s][0] &&
+ turtlePath[s - 1][1] == turtlePath[s][1] ) {
+ continue;
+ }
+
+ var up = turtlePath[s][1] - turtlePath[s - 1][1];
+ var right = turtlePath[s][0] - turtlePath[s - 1][0];
+ var addPoint = ( up != 0 && right != 0 );
+
+ if ( addPoint && up != right ) {
+ fixedTurtlePath.push( [ turtlePath[s][0], turtlePath[s - 1][1] ] );
+ } else if ( addPoint ) {
+ fixedTurtlePath.push( [ turtlePath[s - 1][0], turtlePath[s][1] ] );
+ }
+
+ fixedTurtlePath.push( turtlePath[s] );
+ }
+
+ // printjson( fixedTurtlePath )
+
+ turtlePaths.push( fixedTurtlePath );
+ }
+
+ // Uncomment to print polygon shape
+ // print( grid.toString() )
+
+ var polygon = [];
+ for ( var t = 0; t < turtlePaths.length; t++ ) {
+ for ( var s = 0; s < turtlePaths[t].length; s++ ) {
+ polygon.push( rotatePoint( turtlePaths[t][s] ) );
+ }
+ }
+
+ // Uncomment to print out polygon
+ // printjson( polygon )
+
+ t = db.polytest2;
+ t.drop();
+
+ // Test single and multi-location documents
+ var pointsIn = 0;
+ var pointsOut = 0;
+ var allPointsIn = [];
+ var allPointsOut = [];
+
+ for ( var j = grid[0].length - 1; j >= 0; j-- ) {
+ for ( var i = 0; i < grid.length; i++ ) {
+ var point = rotatePoint( [ i + 0.5, j + 0.5 ] );
+
+ t.insert( { loc : point } );
+ if ( grid[i][j] != undefined ){
+ allPointsIn.push( point );
+ pointsIn++;
+ }
+ else{
+ allPointsOut.push( point );
+ pointsOut++;
+ }
+ }
+ }
+
+ var res = t.ensureIndex({ loc: "2d" }, { bits: 1 + bits, max: bounds[1], min: bounds[0] });
+ assert.writeOK( res );
+
+ t.insert( { loc : allPointsIn } );
+ t.insert( { loc : allPointsOut } );
+ allPoints = allPointsIn.concat( allPointsOut );
+ t.insert( { loc : allPoints } );
+
+ print( "Points : " );
+ printjson( { pointsIn : pointsIn, pointsOut : pointsOut } );
+ //print( t.find( { loc : { "$within" : { "$polygon" : polygon } } } ).count() )
+
+ assert.eq( gridSize[0] * gridSize[1] + 3, t.find().count() );
+ assert.eq( 2 + pointsIn, t.find( { loc : { "$within" : { "$polygon" : polygon } } } ).count() );
+}
diff --git a/jstests/geo_polygon3.js b/jstests/core/geo_polygon3.js
index b144bfbc589..b144bfbc589 100644
--- a/jstests/geo_polygon3.js
+++ b/jstests/core/geo_polygon3.js
diff --git a/jstests/geo_queryoptimizer.js b/jstests/core/geo_queryoptimizer.js
index 7a438bce8fb..7a438bce8fb 100644
--- a/jstests/geo_queryoptimizer.js
+++ b/jstests/core/geo_queryoptimizer.js
diff --git a/jstests/geo_regex0.js b/jstests/core/geo_regex0.js
index 79042b9074e..79042b9074e 100644
--- a/jstests/geo_regex0.js
+++ b/jstests/core/geo_regex0.js
diff --git a/jstests/geo_s2cursorlimitskip.js b/jstests/core/geo_s2cursorlimitskip.js
index a4eaf74afbc..2417d41f24c 100644
--- a/jstests/geo_s2cursorlimitskip.js
+++ b/jstests/core/geo_s2cursorlimitskip.js
@@ -20,8 +20,7 @@ function insertRandomPoints(num, minDist, maxDist){
var lat = sign() * (minDist + random() * (maxDist - minDist));
var lng = sign() * (minDist + random() * (maxDist - minDist));
var point = { geo: { type: "Point", coordinates: [lng, lat] } };
- t.insert(point);
- assert(!db.getLastError());
+ assert.writeOK(t.insert(point));
}
}
diff --git a/jstests/geo_s2dedupnear.js b/jstests/core/geo_s2dedupnear.js
index ac31e082891..ac31e082891 100644
--- a/jstests/geo_s2dedupnear.js
+++ b/jstests/core/geo_s2dedupnear.js
diff --git a/jstests/geo_s2descindex.js b/jstests/core/geo_s2descindex.js
index 39d153a6e55..39d153a6e55 100644
--- a/jstests/geo_s2descindex.js
+++ b/jstests/core/geo_s2descindex.js
diff --git a/jstests/geo_s2disjoint_holes.js b/jstests/core/geo_s2disjoint_holes.js
index cd8f3f4d58f..26d94d9343a 100644
--- a/jstests/geo_s2disjoint_holes.js
+++ b/jstests/core/geo_s2disjoint_holes.js
@@ -50,15 +50,8 @@ print(assert.throws(
// Can't insert a bad polygon or a bad multi-polygon with a 2dsphere index.
//
t.createIndex({p: '2dsphere'});
-t.insert({p: poly});
-var error = t.getDB().getLastError();
-printjson(error);
-assert(error);
-
-t.insert({p: multiPoly});
-error = t.getDB().getLastError();
-printjson(error);
-assert(error);
+assert.writeError(t.insert({p: poly}));
+assert.writeError(t.insert({p: multiPoly}));
//
// Can't create a 2dsphere index when the collection contains a bad polygon or
@@ -66,28 +59,22 @@ assert(error);
//
t.drop();
t.insert({p: poly});
-t.createIndex({p: '2dsphere'});
-error = t.getDB().getLastError();
-printjson(error);
-assert(error);
+res = t.createIndex({p: '2dsphere'});
+assert(!res.ok, tojson(res));
assert.eq(1, t.getIndexes().length);
t.drop();
t.insert({p: multiPoly});
-t.createIndex({p: '2dsphere'});
-error = t.getDB().getLastError();
-printjson(error);
-assert(error);
+res = t.createIndex({p: '2dsphere'});
+assert(!res.ok, tojson(res));
assert.eq(1, t.getIndexes().length);
//
// But with no index we can insert bad polygons and bad multi-polygons.
//
t.drop();
-t.insert({p: poly});
-assert.eq(null, t.getDB().getLastError());
-t.insert({p: multiPoly});
-assert.eq(null, t.getDB().getLastError());
+assert.writeOK(t.insert({p: poly}));
+assert.writeOK(t.insert({p: multiPoly}));
t.drop();
diff --git a/jstests/geo_s2dupe_points.js b/jstests/core/geo_s2dupe_points.js
index 74eb09fa63a..8dd6e804c78 100644
--- a/jstests/geo_s2dupe_points.js
+++ b/jstests/core/geo_s2dupe_points.js
@@ -8,8 +8,7 @@ t.ensureIndex({geo: "2dsphere"})
function testDuplicates(shapeName, shapeWithDupes, shapeWithoutDupes) {
// insert a doc with dupes
- t.insert(shapeWithDupes)
- assert(!db.getLastError(), db.getLastError());
+ assert.writeOK(t.insert(shapeWithDupes));
// duplicates are preserved when the document is fetched by _id
assert.eq(shapeWithDupes, t.findOne({_id: shapeName}));
diff --git a/jstests/geo_s2edgecases.js b/jstests/core/geo_s2edgecases.js
index bf46baba744..bf46baba744 100755
--- a/jstests/geo_s2edgecases.js
+++ b/jstests/core/geo_s2edgecases.js
diff --git a/jstests/geo_s2exact.js b/jstests/core/geo_s2exact.js
index a7cf9627765..a7cf9627765 100644
--- a/jstests/geo_s2exact.js
+++ b/jstests/core/geo_s2exact.js
diff --git a/jstests/geo_s2holesameasshell.js b/jstests/core/geo_s2holesameasshell.js
index c3a127305ff..89ba5ef571b 100644
--- a/jstests/geo_s2holesameasshell.js
+++ b/jstests/core/geo_s2holesameasshell.js
@@ -21,8 +21,7 @@ var polygonWithFullHole = { "type" : "Polygon", "coordinates": [
};
// No keys for insert should error.
-t.insert({geo: polygonWithFullHole})
-assert(db.getLastError())
+assert.writeError(t.insert({geo: polygonWithFullHole}));
// No covering to search over should give an empty result set.
assert.throws(function() {
@@ -38,8 +37,7 @@ var polygonWithTwoHolesCoveringWholeArea = {"type" : "Polygon", "coordinates": [
};
// No keys for insert should error.
-t.insert({geo: polygonWithTwoHolesCoveringWholeArea});
-assert(db.getLastError());
+assert.writeError(t.insert({geo: polygonWithTwoHolesCoveringWholeArea}));
// No covering to search over should give an empty result set.
assert.throws(function() {
diff --git a/jstests/geo_s2index.js b/jstests/core/geo_s2index.js
index cabcea72d19..974e4578dce 100755
--- a/jstests/geo_s2index.js
+++ b/jstests/core/geo_s2index.js
@@ -33,9 +33,9 @@ somepoly = { "type" : "Polygon",
"coordinates" : [ [ [40,5], [40,6], [41,6], [41,5], [40,5]]]}
t.insert( {geo : somepoly, nonGeo: "somepoly" })
-t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } )
+var res = t.ensureIndex( { geo : "2dsphere", nonGeo: 1 } );
// We have a point without any geo data. Don't error.
-assert(!db.getLastError())
+assert.writeOK(res);
res = t.find({ "geo" : { "$geoIntersects" : { "$geometry" : pointA} } });
assert.eq(res.itcount(), 3);
@@ -74,34 +74,41 @@ assert.throws(function() { return t.find({ "nonGeo": "pointA",
// If we specify a datum, it has to be valid (WGS84).
t.drop()
t.ensureIndex({loc: "2dsphere"})
-t.insert({loc: {type:'Point', coordinates: [40, 5], crs:{ type: 'name', properties:{name:'EPSG:2000'}}}})
-assert(db.getLastError());
+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())
-t.insert({loc: {type:'Point', coordinates: [40, 5]}})
-assert(!db.getLastError());
-t.insert({loc: {type:'Point', coordinates: [40, 5], crs:{ type: 'name', properties:{name:'EPSG:4326'}}}})
-assert(!db.getLastError());
-t.insert({loc: {type:'Point', coordinates: [40, 5], crs:{ type: 'name', properties:{name:'urn:ogc:def:crs:OGC:1.3:CRS84'}}}})
-assert(!db.getLastError());
+res = t.insert({ loc: { type: 'Point', coordinates: [40, 5] }});
+assert.writeOK(res);
+res = t.insert({ loc: { type: 'Point',
+ coordinates: [40, 5],
+ crs: { type: 'name', properties: {name :'EPSG:4326' }}}});
+assert.writeOK(res);
+res = t.insert({ loc: { type:'Point',
+ coordinates: [40, 5],
+ crs: { type: 'name',
+ properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84'}}}});
+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.ensureIndex({loc: "2dsphere"}, {finestIndexedLevel: 17, coarsestIndexedLevel: 5})
-assert(!db.getLastError());
+res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 17, coarsestIndexedLevel: 5 });
+assert.writeOK(res);
t.drop();
t.save({loc: [0,0]})
-t.ensureIndex({loc: "2dsphere"}, {finestIndexedLevel: 31, coarsestIndexedLevel: 5})
-assert(db.getLastError());
+res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 31, coarsestIndexedLevel: 5 });
+assert.writeError(res);
t.drop();
t.save({loc: [0,0]})
-t.ensureIndex({loc: "2dsphere"}, {finestIndexedLevel: 30, coarsestIndexedLevel: 0})
-assert(!db.getLastError());
+res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 30, coarsestIndexedLevel: 0 });
+assert.writeOK(res);
t.drop();
t.save({loc: [0,0]})
-t.ensureIndex({loc: "2dsphere"}, {finestIndexedLevel: 30, coarsestIndexedLevel: -1})
-assert(db.getLastError());
+res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 30, coarsestIndexedLevel: -1 });
+assert.writeError(res);
diff --git a/jstests/geo_s2indexoldformat.js b/jstests/core/geo_s2indexoldformat.js
index 6af593a817c..e2cc1f353ee 100755
--- a/jstests/geo_s2indexoldformat.js
+++ b/jstests/core/geo_s2indexoldformat.js
@@ -18,11 +18,11 @@ res = t.find({ "geo" : { "$geoIntersects" : {"$geometry": [41,6]}}})
assert.eq(res.count(), 2);
// We don't support legacy polygons in 2dsphere.
-t.insert( {geo : [[40,5],[40,6],[41,6],[41,5]], nonGeo: ["somepoly"] })
-assert(db.getLastError());
+assert.writeError(t.insert( {geo : [[40,5],[40,6],[41,6],[41,5]], nonGeo: ["somepoly"] }));
+assert.writeError(t.insert( {geo : {a:{x:40,y:5},b:{x:40,y:6},c:{x:41,y:6},d:{x:41,y:5}}}));
-t.insert( {geo : {a:{x:40,y:5},b:{x:40,y:6},c:{x:41,y:6},d:{x:41,y:5}}})
-assert(db.getLastError());
+// Test "Can't canonicalize query: BadValue bad geo query" error.
+assert.throws(function() {
+ t.findOne({ "geo" : { "$geoIntersects" : {"$geometry": [[40,5],[40,6],[41,6],[41,5]]}}});
+});
-res = t.find({ "geo" : { "$geoIntersects" : {"$geometry": [[40,5],[40,6],[41,6],[41,5]]}}})
-assert(db.getLastError());
diff --git a/jstests/geo_s2indexversion1.js b/jstests/core/geo_s2indexversion1.js
index 8524faeddbd..8524faeddbd 100644
--- a/jstests/geo_s2indexversion1.js
+++ b/jstests/core/geo_s2indexversion1.js
diff --git a/jstests/geo_s2intersection.js b/jstests/core/geo_s2intersection.js
index 42abacca98d..42abacca98d 100644
--- a/jstests/geo_s2intersection.js
+++ b/jstests/core/geo_s2intersection.js
diff --git a/jstests/geo_s2largewithin.js b/jstests/core/geo_s2largewithin.js
index 2327f1fb02d..2327f1fb02d 100644
--- a/jstests/geo_s2largewithin.js
+++ b/jstests/core/geo_s2largewithin.js
diff --git a/jstests/geo_s2meridian.js b/jstests/core/geo_s2meridian.js
index 0d5b4b20e6d..6bc7dc735f2 100644
--- a/jstests/geo_s2meridian.js
+++ b/jstests/core/geo_s2meridian.js
@@ -17,8 +17,7 @@ meridianCrossingLine = {
}
};
-t.insert(meridianCrossingLine);
-assert(! db.getLastError());
+assert.writeOK(t.insert(meridianCrossingLine));
lineAlongMeridian = {
type: "LineString",
diff --git a/jstests/geo_s2multi.js b/jstests/core/geo_s2multi.js
index b40eef5543e..56e3ef77068 100644
--- a/jstests/geo_s2multi.js
+++ b/jstests/core/geo_s2multi.js
@@ -5,20 +5,17 @@ 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] ] }
-t.insert({geo: multiPointA});
-assert(!db.getLastError());
+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] ]]}
-t.insert({geo: multiLineStringA});
-assert(!db.getLastError());
+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]]]]}
-t.insert({geo: multiPolygonA})
-assert(!db.getLastError());
+assert.writeOK(t.insert({geo: multiPolygonA}))
assert.eq(3, t.find({geo: {$geoIntersects: {$geometry:
{"type": "Point", "coordinates": [100,0]}}}}).itcount());
@@ -39,8 +36,7 @@ assert.eq(2, t.find({geo: {$geoWithin: {$geometry: multiPolygonA}}}).itcount());
partialPolygonA = { "type": "Polygon", "coordinates":
[ [[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]] ] };
-t.insert({geo: partialPolygonA});
-assert(!db.getLastError());
+assert.writeOK(t.insert({geo: partialPolygonA}));
// Polygon contains itself, the partial poly, and the multipoint
assert.eq(3, t.find({geo: {$geoWithin: {$geometry: multiPolygonA}}}).itcount());
diff --git a/jstests/geo_s2near.js b/jstests/core/geo_s2near.js
index 136e821b4b8..136e821b4b8 100644
--- a/jstests/geo_s2near.js
+++ b/jstests/core/geo_s2near.js
diff --git a/jstests/geo_s2nearComplex.js b/jstests/core/geo_s2nearComplex.js
index 16a24d6db24..835dfe88481 100644
--- a/jstests/geo_s2nearComplex.js
+++ b/jstests/core/geo_s2nearComplex.js
@@ -82,7 +82,6 @@ function uniformPoints(origin, count, minDist, maxDist){
}
for(i=0; i < points.length; i++){
t.insert(points[i]);
- assert(!db.getLastError());
}
return points;
}
@@ -159,8 +158,8 @@ function validateOrdering(query){
var query = {geo: {$geoNear: {$geometry: originGeo}}};
-// Test a uniform distribution of 10000 points.
-uniformPoints(origin, 10000, 0.5, 1.5);
+// Test a uniform distribution of 1000 points.
+uniformPoints(origin, 1000, 0.5, 1.5);
validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
@@ -172,7 +171,7 @@ print(t.find(query).itcount());
t.drop()
t.ensureIndex({geo: "2dsphere"})
// Test a uniform distribution with 5 gaps each with 10 points missing.
-uniformPointsWithGaps(origin, 10000, 1, 10.0, 5, 10);
+uniformPointsWithGaps(origin, 1000, 1, 10.0, 5, 10);
validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
@@ -185,7 +184,7 @@ t.drop()
t.ensureIndex({geo: "2dsphere"})
// Test a uniform distribution with 5 clusters each with between 10 and 100 points.
-uniformPointsWithClusters(origin, 10000, 1, 10.0, 5, 10, 100);
+uniformPointsWithClusters(origin, 1000, 1, 10.0, 5, 10, 100);
validateOrdering({geo: {$geoNear: {$geometry: originGeo}}})
diff --git a/jstests/geo_s2near_equator_opposite.js b/jstests/core/geo_s2near_equator_opposite.js
index 8ee5d486d5e..8ee5d486d5e 100644
--- a/jstests/geo_s2near_equator_opposite.js
+++ b/jstests/core/geo_s2near_equator_opposite.js
diff --git a/jstests/geo_s2nearcorrect.js b/jstests/core/geo_s2nearcorrect.js
index cdb5404a08d..cdb5404a08d 100644
--- a/jstests/geo_s2nearcorrect.js
+++ b/jstests/core/geo_s2nearcorrect.js
diff --git a/jstests/geo_s2nearwithin.js b/jstests/core/geo_s2nearwithin.js
index 99ac12df803..5df27581e5f 100644
--- a/jstests/geo_s2nearwithin.js
+++ b/jstests/core/geo_s2nearwithin.js
@@ -14,9 +14,8 @@ origin = { "type" : "Point", "coordinates": [ 0, 0] }
t.ensureIndex({ geo : "2dsphere" })
// Near requires an index, and 2dsphere is an index. Spherical isn't
// specified so this doesn't work.
-resNear = db.runCommand({geoNear : t.getName(), near: [0, 0],
- query: {geo: {$within: {$center: [[0, 0], 1]}}}})
-assert(db.getLastError());
+assert.commandFailed( db.runCommand({ geoNear: t.getName(), near: [0, 0],
+ query: { geo: { $within: { $center: [[0, 0], 1] }}}}));
// Spherical is specified so this does work. Old style points are weird
// because you can use them with both $center and $centerSphere. Points are
diff --git a/jstests/geo_s2nongeoarray.js b/jstests/core/geo_s2nongeoarray.js
index a1d51929563..02f307fbab1 100644
--- a/jstests/geo_s2nongeoarray.js
+++ b/jstests/core/geo_s2nongeoarray.js
@@ -7,10 +7,8 @@ oldPoint = [40,5]
var data = {geo: oldPoint, nonGeo: [123,456], otherNonGeo: [{b:[1,2]},{b:[3,4]}]};
t.drop();
-t.insert(data);
-assert(!db.getLastError());
-t.ensureIndex({otherNonGeo: 1});
-assert(!db.getLastError());
+assert.writeOK(t.insert(data));
+assert.writeOK(t.ensureIndex({otherNonGeo: 1}));
assert.eq(1, t.find({otherNonGeo: {b:[1,2]}}).itcount());
assert.eq(0, t.find({otherNonGeo: 1}).itcount());
assert.eq(1, t.find({'otherNonGeo.b': 1}).itcount());
diff --git a/jstests/geo_s2nonstring.js b/jstests/core/geo_s2nonstring.js
index 11fc8f4f4c4..11fc8f4f4c4 100755
--- a/jstests/geo_s2nonstring.js
+++ b/jstests/core/geo_s2nonstring.js
diff --git a/jstests/geo_s2nopoints.js b/jstests/core/geo_s2nopoints.js
index c897f39f815..c897f39f815 100644
--- a/jstests/geo_s2nopoints.js
+++ b/jstests/core/geo_s2nopoints.js
diff --git a/jstests/geo_s2oddshapes.js b/jstests/core/geo_s2oddshapes.js
index 24a318d5b98..24a318d5b98 100644
--- a/jstests/geo_s2oddshapes.js
+++ b/jstests/core/geo_s2oddshapes.js
diff --git a/jstests/geo_s2ordering.js b/jstests/core/geo_s2ordering.js
index 531f22a6254..13847b08745 100644
--- a/jstests/geo_s2ordering.js
+++ b/jstests/core/geo_s2ordering.js
@@ -11,14 +11,19 @@ needle = "hari"
function makepoints(needle) {
lat = 0
lng = 0
- points = 200.0
+ points = 50.0
+ var bulk = t.initializeUnorderedBulkOp();
for (var x = -points; x < points; x += 1) {
for (var y = -points; y < points; y += 1) {
tag = x.toString() + "," + y.toString();
- t.insert({nongeo: tag, geo : { "type" : "Point", "coordinates" : [lng + x/points, lat + y/points]}})
+ bulk.insert({ nongeo: tag,
+ geo: {
+ type: "Point",
+ coordinates: [lng + x/points, lat + y/points]}});
}
}
- t.insert({nongeo: needle, geo : { "type" : "Point", "coordinates" : [0,0]}})
+ bulk.insert({ nongeo: needle, geo: { type: "Point", coordinates: [0,0] }});
+ assert.writeOK(bulk.execute());
}
function runTest(index) {
diff --git a/jstests/geo_s2overlappingpolys.js b/jstests/core/geo_s2overlappingpolys.js
index 0d96222206c..0d96222206c 100644
--- a/jstests/geo_s2overlappingpolys.js
+++ b/jstests/core/geo_s2overlappingpolys.js
diff --git a/jstests/geo_s2polywithholes.js b/jstests/core/geo_s2polywithholes.js
index beb9932739f..f396f6b9a4f 100755
--- a/jstests/geo_s2polywithholes.js
+++ b/jstests/core/geo_s2polywithholes.js
@@ -27,8 +27,7 @@ var polygonWithProtrudingHole = {"type" : "Polygon", "coordinates": [
};
// Bad shell, should error.
-t.insert({geo: polygonWithProtrudingHole});
-assert(db.getLastError());
+assert.writeError(t.insert({geo: polygonWithProtrudingHole}));
// Can't search with bogus poly.
assert.throws(function() {
@@ -44,5 +43,4 @@ var polyWithOverlappingHoles = {"type" : "Polygon", "coordinates": [
]
};
-t.insert({geo: polyWithOverlappingHoles});
-assert(db.getLastError());
+assert.writeError(t.insert({geo: polyWithOverlappingHoles}));
diff --git a/jstests/geo_s2selfintersectingpoly.js b/jstests/core/geo_s2selfintersectingpoly.js
index 4b7e0d4eff3..f34ea3a5ff1 100644
--- a/jstests/geo_s2selfintersectingpoly.js
+++ b/jstests/core/geo_s2selfintersectingpoly.js
@@ -8,5 +8,4 @@ var intersectingPolygon = {"type": "Polygon", "coordinates": [
/*
* Self intersecting polygons should cause a parse exception.
*/
-t.insert({geo : intersectingPolygon});
-assert(db.getLastError());
+assert.writeError(t.insert({geo : intersectingPolygon}));
diff --git a/jstests/geo_s2sparse.js b/jstests/core/geo_s2sparse.js
index 3fbc01188a3..3fbc01188a3 100644
--- a/jstests/geo_s2sparse.js
+++ b/jstests/core/geo_s2sparse.js
diff --git a/jstests/geo_s2twofields.js b/jstests/core/geo_s2twofields.js
index 6beac190fb0..2292e8936e8 100644
--- a/jstests/geo_s2twofields.js
+++ b/jstests/core/geo_s2twofields.js
@@ -21,8 +21,9 @@ var degrees = 5;
for (var i = 0; i < maxPoints; ++i) {
var fromCoord = randomCoord(nyc.coordinates, 0, degrees);
var toCoord = randomCoord(miami.coordinates, 0, degrees);
- t.insert({from: {type: "Point", coordinates: fromCoord}, to: { type: "Point", coordinates: toCoord}})
- assert(!db.getLastError());
+ var res = t.insert({ from: { type: "Point", coordinates: fromCoord },
+ to: { type: "Point", coordinates: toCoord}});
+ assert.writeOK(res);
}
function semiRigorousTime(func) {
diff --git a/jstests/geo_s2validindex.js b/jstests/core/geo_s2validindex.js
index fee00d8d208..bc8a569e559 100644
--- a/jstests/geo_s2validindex.js
+++ b/jstests/core/geo_s2validindex.js
@@ -6,19 +6,19 @@ var coll = db.getCollection("twodspherevalid");
// Valid index
coll.drop();
-assert.eq(undefined, coll.ensureIndex({geo : "2dsphere", other : 1}));
+assert.writeOK(coll.ensureIndex({geo : "2dsphere", other : 1}));
// Valid index
coll.drop();
-assert.eq(undefined, coll.ensureIndex({geo : "2dsphere", other : 1, geo2 : "2dsphere"}));
+assert.writeOK(coll.ensureIndex({geo : "2dsphere", other : 1, geo2 : "2dsphere"}));
// Invalid index, using hash with 2dsphere
coll.drop();
-assert.neq(undefined, coll.ensureIndex({geo : "2dsphere", other : "hash"}).err);
+assert.writeError(coll.ensureIndex({geo : "2dsphere", other : "hash"}));
// Invalid index, using 2d with 2dsphere
coll.drop();
-assert.neq(undefined, coll.ensureIndex({geo : "2dsphere", other : "2d"}).err);
+assert.writeError(coll.ensureIndex({geo : "2dsphere", other : "2d"}));
jsTest.log("Success!");
diff --git a/jstests/geo_s2within.js b/jstests/core/geo_s2within.js
index 87fd32a7676..87fd32a7676 100644
--- a/jstests/geo_s2within.js
+++ b/jstests/core/geo_s2within.js
diff --git a/jstests/core/geo_small_large.js b/jstests/core/geo_small_large.js
new file mode 100644
index 00000000000..e927e8d5402
--- /dev/null
+++ b/jstests/core/geo_small_large.js
@@ -0,0 +1,158 @@
+// SERVER-2386, general geo-indexing using very large and very small bounds
+
+load( "jstests/libs/geo_near_random.js" );
+
+// Do some random tests (for near queries) with very large and small ranges
+
+var test = new GeoNearRandomTest( "geo_small_large" );
+
+bounds = { min : -Math.pow( 2, 34 ), max : Math.pow( 2, 34 ) };
+
+test.insertPts( 50, bounds );
+
+printjson( db["geo_small_large"].find().limit( 10 ).toArray() );
+
+test.testPt( [ 0, 0 ] );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+
+test = new GeoNearRandomTest( "geo_small_large" );
+
+bounds = { min : -Math.pow( 2, -34 ), max : Math.pow( 2, -34 ) };
+
+test.insertPts( 50, bounds );
+
+printjson( db["geo_small_large"].find().limit( 10 ).toArray() );
+
+test.testPt( [ 0, 0 ] );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+test.testPt( test.mkPt( undefined, bounds ) );
+
+
+// Check that our box and circle queries also work
+var scales = [
+ Math.pow( 2, 40 ),
+ Math.pow( 2, -40 ),
+ Math.pow(2, 2),
+ Math.pow(3, -15),
+ Math.pow(3, 15)
+];
+
+for ( var i = 0; i < scales.length; i++ ) {
+
+ var scale = scales[i];
+
+ var eps = Math.pow( 2, -7 ) * scale;
+ var radius = 5 * scale;
+ var max = 10 * scale;
+ var min = -max;
+ var range = max - min;
+ var bits = 2 + Math.random() * 30;
+
+ var t = db["geo_small_large"];
+ t.drop();
+ t.ensureIndex( { p : "2d" }, { min : min, max : max, bits : bits });
+
+ var outPoints = 0;
+ var inPoints = 0;
+
+ printjson({ eps : eps, radius : radius, max : max, min : min, range : range, bits : bits });
+
+ // Put a point slightly inside and outside our range
+ for ( var j = 0; j < 2; j++ ) {
+ var currRad = ( j % 2 == 0 ? radius + eps : radius - eps );
+ var res = t.insert( { p : { x : currRad, y : 0 } } );
+ print( res.toString() );
+ }
+
+ printjson( t.find().toArray() );
+
+ assert.eq( t.count( { p : { $within : { $center : [[0, 0], radius ] } } } ), 1,
+ "Incorrect center points found!" );
+ assert.eq( t.count( { p : { $within : { $box : [ [ -radius, -radius ], [ radius, radius ] ] } } } ), 1,
+ "Incorrect box points found!" );
+
+ var shouldFind = [];
+ var randoms = [];
+
+ for ( var j = 0; j < 2; j++ ) {
+
+ var randX = Math.random(); // randoms[j].randX
+ var randY = Math.random(); // randoms[j].randY
+
+ randoms.push({ randX : randX, randY : randY });
+
+ var x = randX * ( range - eps ) + eps + min;
+ var y = randY * ( range - eps ) + eps + min;
+
+ t.insert( { p : [ x, y ] } );
+
+ if ( x * x + y * y > radius * radius ){
+ // print( "out point ");
+ // printjson({ x : x, y : y })
+ outPoints++;
+ }
+ else{
+ // print( "in point ");
+ // printjson({ x : x, y : y })
+ inPoints++;
+ shouldFind.push({ x : x, y : y, radius : Math.sqrt( x * x + y * y ) });
+ }
+ }
+
+ /*
+ function printDiff( didFind, shouldFind ){
+
+ for( var i = 0; i < shouldFind.length; i++ ){
+ var beenFound = false;
+ for( var j = 0; j < didFind.length && !beenFound ; j++ ){
+ beenFound = shouldFind[i].x == didFind[j].x &&
+ shouldFind[i].y == didFind[j].y
+ }
+
+ if( !beenFound ){
+ print( "Could not find: " )
+ shouldFind[i].inRadius = ( radius - shouldFind[i].radius >= 0 )
+ printjson( shouldFind[i] )
+ }
+ }
+ }
+
+ print( "Finding random pts... ")
+ var found = t.find( { p : { $within : { $center : [[0, 0], radius ] } } } ).toArray()
+ var didFind = []
+ for( var f = 0; f < found.length; f++ ){
+ //printjson( found[f] )
+ var x = found[f].p.x != undefined ? found[f].p.x : found[f].p[0]
+ var y = found[f].p.y != undefined ? found[f].p.y : found[f].p[1]
+ didFind.push({ x : x, y : y, radius : Math.sqrt( x * x + y * y ) })
+ }
+
+ print( "Did not find but should: ")
+ printDiff( didFind, shouldFind )
+ print( "Found but should not have: ")
+ printDiff( shouldFind, didFind )
+ */
+
+ assert.eq( t.count( { p : { $within : { $center : [[0, 0], radius ] } } } ), 1 + inPoints,
+ "Incorrect random center points found!\n" + tojson( randoms ) );
+
+ print("Found " + inPoints + " points in and " + outPoints + " points out.");
+
+ var found = t.find( { p : { $near : [0, 0], $maxDistance : radius } } ).toArray();
+ var dist = 0;
+ for( var f = 0; f < found.length; f++ ){
+ var x = found[f].p.x != undefined ? found[f].p.x : found[f].p[0];
+ var y = found[f].p.y != undefined ? found[f].p.y : found[f].p[1];
+ print( "Dist: x : " + x + " y : " + y + " dist : " +
+ Math.sqrt( x * x + y * y) + " radius : " + radius );
+ }
+
+ assert.eq( t.count( { p : { $near : [0, 0], $maxDistance : radius } } ), 1 + inPoints,
+ "Incorrect random center points found near!\n" + tojson( randoms ) );
+}
+
diff --git a/jstests/geo_sort1.js b/jstests/core/geo_sort1.js
index 67de80e65c7..67de80e65c7 100644
--- a/jstests/geo_sort1.js
+++ b/jstests/core/geo_sort1.js
diff --git a/jstests/geo_uniqueDocs.js b/jstests/core/geo_uniqueDocs.js
index 61f1a40522d..61f1a40522d 100644
--- a/jstests/geo_uniqueDocs.js
+++ b/jstests/core/geo_uniqueDocs.js
diff --git a/jstests/geo_uniqueDocs2.js b/jstests/core/geo_uniqueDocs2.js
index f9b95113f78..f9b95113f78 100644
--- a/jstests/geo_uniqueDocs2.js
+++ b/jstests/core/geo_uniqueDocs2.js
diff --git a/jstests/geo_update.js b/jstests/core/geo_update.js
index dd4b28c8374..dd4b28c8374 100644
--- a/jstests/geo_update.js
+++ b/jstests/core/geo_update.js
diff --git a/jstests/geo_update1.js b/jstests/core/geo_update1.js
index 68a8de668b3..6352ef0aa19 100644
--- a/jstests/geo_update1.js
+++ b/jstests/core/geo_update1.js
@@ -24,15 +24,13 @@ function p(){
p()
-t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B1" )
+var res = t.update({ loc: { $within: { $center: [[ 5, 5 ], 2 ]}}}, { $inc: { z: 1 }}, false, true);
+assert.writeOK( res );
p()
-t.update({}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B2" )
+assert.writeOK(t.update({}, {'$inc' : { 'z' : 1}}, false, true));
p()
-
-t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B3" )
+res = t.update({ loc: { $within: { $center: [[ 5, 5 ], 2 ]}}}, { $inc: { z: 1 }}, false, true);
+assert.writeOK( res );
p()
diff --git a/jstests/geo_update2.js b/jstests/core/geo_update2.js
index 2308b2c7899..6a42619ac98 100644
--- a/jstests/geo_update2.js
+++ b/jstests/core/geo_update2.js
@@ -25,16 +25,15 @@ function p(){
p()
-t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B1" )
+assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
+ {'$inc' : { 'z' : 1}}, false, true));
p()
-t.update({}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B2" )
+assert.writeOK(t.update({}, {'$inc' : { 'z' : 1}}, false, true));
p()
-t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
-assert.isnull( db.getLastError() , "B3" )
+assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
+ {'$inc' : { 'z' : 1}}, false, true));
p()
diff --git a/jstests/geo_update_btree.js b/jstests/core/geo_update_btree.js
index 38d9692faeb..225a6635903 100644
--- a/jstests/geo_update_btree.js
+++ b/jstests/core/geo_update_btree.js
@@ -5,21 +5,24 @@ coll.drop()
coll.ensureIndex( { loc : '2d' } )
-for ( i = 0; i < 10000; i++ ) {
- coll.insert( { loc : [ Random.rand() * 180, Random.rand() * 180 ], v : '' } );
+var big = new Array( 3000 ).toString()
+
+if (testingReplication) {
+ coll.setWriteConcern({ w: 2 });
}
-var big = new Array( 3000 ).toString()
+var parallelInsert = startParallelShell(
+ "for ( var i = 0; i < 1000; i++ ) {" +
+ " var doc = { loc: [ Random.rand() * 180, Random.rand() * 180 ], v: '' }" +
+ " db.jstests_geo_update_btree.insert(doc);" +
+ "}");
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 )
- if (testingReplication)
- db.getLastError(2);
- else
- db.getLastError();
-
if( i % 10 == 0 ) print( i );
}
+
+parallelInsert();
diff --git a/jstests/geo_update_btree2.js b/jstests/core/geo_update_btree2.js
index d99970c73e0..d99970c73e0 100644
--- a/jstests/geo_update_btree2.js
+++ b/jstests/core/geo_update_btree2.js
diff --git a/jstests/geo_update_dedup.js b/jstests/core/geo_update_dedup.js
index 8ec08b82ea0..def93a839e4 100644
--- a/jstests/geo_update_dedup.js
+++ b/jstests/core/geo_update_dedup.js
@@ -12,15 +12,15 @@ t.save({locs: [[49.999,49.999], [50.0,50.0], [50.001,50.001]]});
var q = {locs: {$near: [50.0, 50.0]}};
assert.eq(1, t.find(q).itcount(), 'duplicates returned from query');
-t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
-assert.eq(1, db.getLastErrorObj().n);
+var res = t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true);
+assert.eq(1, res.nMatched);
assert.eq(1, t.findOne().touchCount);
t.drop();
t.ensureIndex({locs: "2d"});
t.save({locs: [{x:49.999,y:49.999}, {x:50.0,y:50.0}, {x:50.001,y:50.001}]});
-t.update({locs: {$near: {x:50.0, y:50.0}}}, {$inc: {touchCount: 1}});
-assert.eq(1, db.getLastErrorObj().n);
+res = t.update({locs: {$near: {x:50.0, y:50.0}}}, {$inc: {touchCount: 1}});
+assert.eq(1, res.nMatched);
assert.eq(1, t.findOne().touchCount);
// 2d index with $within
@@ -28,8 +28,8 @@ t.drop();
t.ensureIndex({loc: "2d"});
t.save({loc: [[0, 0], [1, 1]]});
-t.update({loc: {$within: {$center: [[0, 0], 2]}}}, {$inc: {touchCount: 1}}, false, true);
-assert.eq(1, db.getLastErrorObj().n);
+res = t.update({loc: {$within: {$center: [[0, 0], 2]}}}, {$inc: {touchCount: 1}}, false, true);
+assert.eq(1, res.nMatched);
assert.eq(1, t.findOne().touchCount);
// 2dsphere index with $geoNear
@@ -39,9 +39,9 @@ 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})
-t.update({geo: {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
- {$inc: {touchCount: 1}}, false, true);
-assert.eq(1, db.getLastErrorObj().n);
+res = t.update({geo: {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
+ {$inc: {touchCount: 1}}, false, true);
+assert.eq(1, res.nMatched);
assert.eq(1, t.findOne().touchCount);
t.drop();
@@ -53,8 +53,8 @@ var locdata = [
t.save({locdata: locdata, count: 0})
t.ensureIndex({"locdata.geo": "2dsphere"});
-t.update({"locdata.geo": {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
- {$inc: {touchCount: 1}}, false, true);
-assert.eq(1, db.getLastErrorObj().n);
+res = t.update({"locdata.geo": {$geoNear: {"type" : "Point", "coordinates" : [50.0, 50.0]}}},
+ {$inc: {touchCount: 1}}, false, true);
+assert.eq(1, res.nMatched);
assert.eq(1, t.findOne().touchCount);
diff --git a/jstests/geo_withinquery.js b/jstests/core/geo_withinquery.js
index 11701d34c62..11701d34c62 100644
--- a/jstests/geo_withinquery.js
+++ b/jstests/core/geo_withinquery.js
diff --git a/jstests/geoa.js b/jstests/core/geoa.js
index 3081f6c5c2e..3081f6c5c2e 100644
--- a/jstests/geoa.js
+++ b/jstests/core/geoa.js
diff --git a/jstests/geob.js b/jstests/core/geob.js
index 0dcc2658ba2..0dcc2658ba2 100644
--- a/jstests/geob.js
+++ b/jstests/core/geob.js
diff --git a/jstests/geoc.js b/jstests/core/geoc.js
index 8b0178095e8..8b0178095e8 100644
--- a/jstests/geoc.js
+++ b/jstests/core/geoc.js
diff --git a/jstests/geod.js b/jstests/core/geod.js
index 6e458454a71..6e458454a71 100644
--- a/jstests/geod.js
+++ b/jstests/core/geod.js
diff --git a/jstests/geoe.js b/jstests/core/geoe.js
index 22feb83ab1e..22feb83ab1e 100644
--- a/jstests/geoe.js
+++ b/jstests/core/geoe.js
diff --git a/jstests/geof.js b/jstests/core/geof.js
index 786ead6a94a..786ead6a94a 100644
--- a/jstests/geof.js
+++ b/jstests/core/geof.js
diff --git a/jstests/geonear_cmd_input_validation.js b/jstests/core/geonear_cmd_input_validation.js
index 2a44391183b..2a44391183b 100644
--- a/jstests/geonear_cmd_input_validation.js
+++ b/jstests/core/geonear_cmd_input_validation.js
diff --git a/jstests/geonear_validate.js b/jstests/core/geonear_validate.js
index 49d4c1ade15..49d4c1ade15 100644
--- a/jstests/geonear_validate.js
+++ b/jstests/core/geonear_validate.js
diff --git a/jstests/getlog1.js b/jstests/core/getlog1.js
index 75fbeabddf2..75fbeabddf2 100644
--- a/jstests/getlog1.js
+++ b/jstests/core/getlog1.js
diff --git a/jstests/getlog2.js b/jstests/core/getlog2.js
index 2712f96fc3e..846f0548309 100644
--- a/jstests/getlog2.js
+++ b/jstests/core/getlog2.js
@@ -38,8 +38,7 @@ if(db.isMaster().msg != "isdbgrid") {
// same, but for update
assert( contains(resp.log, function(v) {
- print(v);
- return v.indexOf(" update ") != -1 && v.indexOf("query:") != -1 &&
+ return v.indexOf(" update ") != -1 && v.indexOf("query") != -1 &&
v.indexOf("nscanned:") != -1 &&
v.indexOf("nscannedObjects:") != -1 &&
v.indexOf("SENTINEL") != -1;
diff --git a/jstests/group1.js b/jstests/core/group1.js
index c4147c0d89a..c4147c0d89a 100644
--- a/jstests/group1.js
+++ b/jstests/core/group1.js
diff --git a/jstests/group2.js b/jstests/core/group2.js
index a8e6653470a..a8e6653470a 100644
--- a/jstests/group2.js
+++ b/jstests/core/group2.js
diff --git a/jstests/group3.js b/jstests/core/group3.js
index d113b9d570f..d113b9d570f 100644
--- a/jstests/group3.js
+++ b/jstests/core/group3.js
diff --git a/jstests/group4.js b/jstests/core/group4.js
index e75c0d1ae2c..e75c0d1ae2c 100644
--- a/jstests/group4.js
+++ b/jstests/core/group4.js
diff --git a/jstests/group5.js b/jstests/core/group5.js
index 3534fe5f030..3534fe5f030 100644
--- a/jstests/group5.js
+++ b/jstests/core/group5.js
diff --git a/jstests/group6.js b/jstests/core/group6.js
index b77a37a5d11..b77a37a5d11 100644
--- a/jstests/group6.js
+++ b/jstests/core/group6.js
diff --git a/jstests/group7.js b/jstests/core/group7.js
index f18a84055f4..1413000079c 100644
--- a/jstests/group7.js
+++ b/jstests/core/group7.js
@@ -7,12 +7,14 @@ function checkForYield( docs, updates ) {
t.drop();
a = 0;
for( var i = 0; i < docs; ++i ) {
- t.save( {a:a} );
+ t.save( {a:a} );
}
- db.getLastError();
// Iteratively update all a values atomically.
- p = startParallelShell( 'for( a = 0; a < ' + updates + '; ++a ) { db.jstests_group7.update( {$atomic:true}, {$set:{a:a}}, false, true ); db.getLastError(); }' );
+ p = startParallelShell(
+ 'for( a = 0; a < ' + updates + '; ++a ) {' +
+ 'db.jstests_group7.update({ $atomic: true }, { $set: { a: a }}, false, true);' +
+ '}' );
for( var i = 0; i < updates; ++i ) {
print("running group " + i + " of " + updates);
@@ -36,7 +38,7 @@ for( var j = 1; j <= 6; ++j ) {
print("Iteration " + j + " docs = " + docs + " updates = " + updates);
if ( checkForYield( docs, updates ) ) {
yielded = true;
- break;
+ break;
}
// Increase docs and updates to encourage yielding.
docs *= 2;
diff --git a/jstests/group_empty.js b/jstests/core/group_empty.js
index 62a734ed0f8..62a734ed0f8 100644
--- a/jstests/group_empty.js
+++ b/jstests/core/group_empty.js
diff --git a/jstests/grow_hash_table.js b/jstests/core/grow_hash_table.js
index 3e148b7240f..1f96820d61f 100644
--- a/jstests/grow_hash_table.js
+++ b/jstests/core/grow_hash_table.js
@@ -23,10 +23,7 @@ var doTest = function(count) {
}
// Store the document
- testDB.collection.insert(doc);
- var errorObj = testDB.getLastErrorObj();
- assert(errorObj.err == null,
- 'Failed to insert document, getLastErrorObj = ' + tojsononeline(errorObj));
+ assert.writeOK(testDB.collection.insert(doc));
// Try to read the document using a large projection
try {
diff --git a/jstests/hashindex1.js b/jstests/core/hashindex1.js
index 34bd6dc0725..34bd6dc0725 100644
--- a/jstests/hashindex1.js
+++ b/jstests/core/hashindex1.js
diff --git a/jstests/hashtest1.js b/jstests/core/hashtest1.js
index 981a0c36877..981a0c36877 100644
--- a/jstests/hashtest1.js
+++ b/jstests/core/hashtest1.js
diff --git a/jstests/hint1.js b/jstests/core/hint1.js
index b5a580f2b93..b5a580f2b93 100644
--- a/jstests/hint1.js
+++ b/jstests/core/hint1.js
diff --git a/jstests/hostinfo.js b/jstests/core/hostinfo.js
index 16c3810b2c4..16c3810b2c4 100644
--- a/jstests/hostinfo.js
+++ b/jstests/core/hostinfo.js
diff --git a/jstests/id1.js b/jstests/core/id1.js
index 9236340e4ec..9236340e4ec 100644
--- a/jstests/id1.js
+++ b/jstests/core/id1.js
diff --git a/jstests/idhack.js b/jstests/core/idhack.js
index 21409645489..21409645489 100644
--- a/jstests/idhack.js
+++ b/jstests/core/idhack.js
diff --git a/jstests/in.js b/jstests/core/in.js
index da1313692e1..da1313692e1 100644
--- a/jstests/in.js
+++ b/jstests/core/in.js
diff --git a/jstests/in2.js b/jstests/core/in2.js
index 66b90daa25a..66b90daa25a 100644
--- a/jstests/in2.js
+++ b/jstests/core/in2.js
diff --git a/jstests/in3.js b/jstests/core/in3.js
index b0a8bb7b81f..b0a8bb7b81f 100644
--- a/jstests/in3.js
+++ b/jstests/core/in3.js
diff --git a/jstests/in4.js b/jstests/core/in4.js
index 3e3dca29528..3e3dca29528 100644
--- a/jstests/in4.js
+++ b/jstests/core/in4.js
diff --git a/jstests/in5.js b/jstests/core/in5.js
index 435c8864004..435c8864004 100644
--- a/jstests/in5.js
+++ b/jstests/core/in5.js
diff --git a/jstests/in6.js b/jstests/core/in6.js
index f114d93442a..f114d93442a 100644
--- a/jstests/in6.js
+++ b/jstests/core/in6.js
diff --git a/jstests/in8.js b/jstests/core/in8.js
index 5e7e587629f..5e7e587629f 100644
--- a/jstests/in8.js
+++ b/jstests/core/in8.js
diff --git a/jstests/in9.js b/jstests/core/in9.js
index cbe28e2e2df..cbe28e2e2df 100644
--- a/jstests/in9.js
+++ b/jstests/core/in9.js
diff --git a/jstests/ina.js b/jstests/core/ina.js
index cf614ab994d..cf614ab994d 100644
--- a/jstests/ina.js
+++ b/jstests/core/ina.js
diff --git a/jstests/inb.js b/jstests/core/inb.js
index 34ec843d36c..34ec843d36c 100644
--- a/jstests/inb.js
+++ b/jstests/core/inb.js
diff --git a/jstests/inc-SERVER-7446.js b/jstests/core/inc-SERVER-7446.js
index 73cdef3dbd5..c8066a8e491 100644
--- a/jstests/inc-SERVER-7446.js
+++ b/jstests/core/inc-SERVER-7446.js
@@ -3,9 +3,8 @@ var c = db.incSERVER7446
// A 32 bit overflow spills to 64 bits
c.drop();
c.save( { a: NumberInt( "2147483647" ) } );
-c.update( {}, { $inc:{ a:NumberInt( 1 ) } } );
-var gle = db.getLastErrorObj();
-assert.eq(1, gle.n, "Object not inserted");
+var updateResult = c.update( {}, { $inc:{ a:NumberInt( 1 ) } } );
+assert.eq(1, updateResult.nMatched, "Object not modified");
var res = c.findOne();
assert.eq(NumberLong, res.a.constructor,
"NumberInt incremented beyond std::numeric_limits<in32_t>::max() not NumberLong");
@@ -15,9 +14,8 @@ assert.eq(NumberLong("2147483648"), res.a,
// A 32 bit underflow spills to 64 bits
c.drop();
c.save( { a: NumberInt( "-2147483648" ) } );
-c.update( {}, { $inc:{ a:NumberInt( -1 ) } } );
-gle = db.getLastErrorObj();
-assert.eq(1, gle.n, "Object not inserted");
+updateResult = c.update( {}, { $inc:{ a:NumberInt( -1 ) } } );
+assert.eq(1, updateResult.nMatched, "Object not modified");
res = c.findOne();
assert.eq(NumberLong, res.a.constructor,
"NumberInt decremented beyond std::numeric_limits<in32_t>::min() not NumberLong");
@@ -27,17 +25,15 @@ assert.eq(NumberLong("-2147483649"), res.a,
// A 64 bit overflow is an error
c.drop();
c.save( { a: NumberLong( "9223372036854775807" ) } );
-c.update( {}, { $inc:{ a:NumberInt( 1 ) } } );
-gle = db.getLastErrorObj();
-assert.eq(0, gle.n,
+updateResult = c.update( {}, { $inc:{ a:NumberInt( 1 ) } } );
+assert.eq(0, updateResult.nMatched,
"Did not fail to increment a NumberLong past std::numeric_limits<int64_t>::max()");
// A 64 bit underflow is an error
c.drop();
c.save( { a: NumberLong( "-9223372036854775808" ) } );
-c.update( {}, { $inc:{ a:NumberInt( -1 ) } } );
-gle = db.getLastErrorObj();
-assert.eq(0, gle.n,
+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()
diff --git a/jstests/inc1.js b/jstests/core/inc1.js
index 027f307a476..027f307a476 100644
--- a/jstests/inc1.js
+++ b/jstests/core/inc1.js
diff --git a/jstests/inc2.js b/jstests/core/inc2.js
index 75a8e65a384..75a8e65a384 100644
--- a/jstests/inc2.js
+++ b/jstests/core/inc2.js
diff --git a/jstests/inc3.js b/jstests/core/inc3.js
index baeeb198cf4..baeeb198cf4 100644
--- a/jstests/inc3.js
+++ b/jstests/core/inc3.js
diff --git a/jstests/index1.js b/jstests/core/index1.js
index 64bbfa8732b..64bbfa8732b 100644
--- a/jstests/index1.js
+++ b/jstests/core/index1.js
diff --git a/jstests/index10.js b/jstests/core/index10.js
index 92f5927097d..d86402e41af 100644
--- a/jstests/index10.js
+++ b/jstests/core/index10.js
@@ -12,10 +12,10 @@ t.save( {i:1} );
t.ensureIndex( {i:1} );
assert.eq( 5, t.count() );
t.dropIndexes();
-t.ensureIndex( {i:1}, true );
-err = db.getLastErrorObj();
-assert( err.err , "err.err" );
-assert.eq( 11000, err.code );
+var err = t.ensureIndex( {i:1}, true );
+assert.writeError(err)
+assert.eq( 11000, err.getWriteError().code );
+
assert( 1 == db.system.indexes.count( {ns:"test.jstests_index10" } ), "only id index" );
// t.dropIndexes();
diff --git a/jstests/index13.js b/jstests/core/index13.js
index 7e317d90d94..7e317d90d94 100644
--- a/jstests/index13.js
+++ b/jstests/core/index13.js
diff --git a/jstests/index2.js b/jstests/core/index2.js
index b54abcaa792..b54abcaa792 100644
--- a/jstests/index2.js
+++ b/jstests/core/index2.js
diff --git a/jstests/index3.js b/jstests/core/index3.js
index 80139460cb4..80139460cb4 100644
--- a/jstests/index3.js
+++ b/jstests/core/index3.js
diff --git a/jstests/index4.js b/jstests/core/index4.js
index 9dd731c83ee..9dd731c83ee 100644
--- a/jstests/index4.js
+++ b/jstests/core/index4.js
diff --git a/jstests/index5.js b/jstests/core/index5.js
index 841ac12ed45..841ac12ed45 100644
--- a/jstests/index5.js
+++ b/jstests/core/index5.js
diff --git a/jstests/index6.js b/jstests/core/index6.js
index 8dbd8f74fcf..8dbd8f74fcf 100644
--- a/jstests/index6.js
+++ b/jstests/core/index6.js
diff --git a/jstests/index7.js b/jstests/core/index7.js
index 9e3a6c66d11..9e3a6c66d11 100644
--- a/jstests/index7.js
+++ b/jstests/core/index7.js
diff --git a/jstests/index8.js b/jstests/core/index8.js
index 719ad2dd2cb..719ad2dd2cb 100644
--- a/jstests/index8.js
+++ b/jstests/core/index8.js
diff --git a/jstests/index9.js b/jstests/core/index9.js
index 04b900949ec..04b900949ec 100644
--- a/jstests/index9.js
+++ b/jstests/core/index9.js
diff --git a/jstests/indexOtherNamespace.js b/jstests/core/indexOtherNamespace.js
index 5bb7355ddb6..7df55188606 100644
--- a/jstests/indexOtherNamespace.js
+++ b/jstests/core/indexOtherNamespace.js
@@ -1,10 +1,5 @@
// SERVER-8814: Test that only the system.indexes namespace can be used to build indexes.
-function assertGLENotOK(status) {
- assert(status.ok && status.err !== null,
- "Expected not-OK status object; found " + tojson(status));
-}
-
var otherDB = db.getSiblingDB("indexOtherNS");
otherDB.dropDatabase();
@@ -12,8 +7,19 @@ otherDB.foo.insert({a:1})
assert.eq(1, otherDB.system.indexes.count());
assert.eq("BasicCursor", otherDB.foo.find({a:1}).explain().cursor);
-otherDB.randomNS.system.indexes.insert({ns:"indexOtherNS.foo", key:{a:1}, name:"a_1"});
-assertGLENotOK(otherDB.getLastErrorObj());
+if (db.getMongo().writeMode() == 'commands') {
+ assert.throws(function() {
+ otherDB.randomNS.system.indexes.insert({ ns: "indexOtherNS.foo",
+ key: { a: 1}, name: "a_1" });
+ });
+}
+else {
+ assert.writeError(otherDB.randomNS.system.indexes.insert({ ns: "indexOtherNS.foo",
+ key: { a: 1 }, name: "a_1"}));
+}
+
+
+
// Assert that index didn't actually get built
assert.eq(1, otherDB.system.indexes.count());
assert.eq(null, otherDB.system.namespaces.findOne({name : "indexOtherNS.foo.$a_1"}));
diff --git a/jstests/indexStatsCommand.js b/jstests/core/indexStatsCommand.js
index 9c055e37e26..9c055e37e26 100644
--- a/jstests/indexStatsCommand.js
+++ b/jstests/core/indexStatsCommand.js
diff --git a/jstests/index_arr1.js b/jstests/core/index_arr1.js
index d35cb80a83f..d35cb80a83f 100644
--- a/jstests/index_arr1.js
+++ b/jstests/core/index_arr1.js
diff --git a/jstests/index_arr2.js b/jstests/core/index_arr2.js
index 321bed8ad03..101655f2ce9 100644
--- a/jstests/index_arr2.js
+++ b/jstests/core/index_arr2.js
@@ -34,8 +34,8 @@ function test( withIndex ){
t.ensureIndex( { 'a.b.c' : 1 } , { name : "x" } )
}
- t.update(query, { '$set' : { "a.0.b.c" : 0 } } , false , true )
- assert.eq( Z , db.getLastErrorObj().n , "num updated withIndex:" + withIndex );
+ var res = t.update(query, { '$set' : { "a.0.b.c" : 0 } } , false , true );
+ assert.eq( Z, res.nMatched, "num updated withIndex:" + withIndex );
// now see how many were actually updated.
query['a.b.c'] = 0;
diff --git a/jstests/index_big1.js b/jstests/core/index_big1.js
index 3e53692a2f6..6fbffa4415e 100644
--- a/jstests/index_big1.js
+++ b/jstests/core/index_big1.js
@@ -9,10 +9,12 @@ var s = "";
t.ensureIndex( { a : 1 , x : 1 } )
+var bulk = t.initializeUnorderedBulkOp();
for ( i=0; i<N; i++ ) {
- t.insert( { a : i + .5 , x : s } )
+ bulk.insert( { a : i + .5 , x : s } );
s += "x";
}
+assert.writeError(bulk.execute());
assert.eq( 2 , t.getIndexes().length );
diff --git a/jstests/index_bigkeys.js b/jstests/core/index_bigkeys.js
index b0ea66d65f8..b0ea66d65f8 100755
--- a/jstests/index_bigkeys.js
+++ b/jstests/core/index_bigkeys.js
diff --git a/jstests/index_bigkeys_update.js b/jstests/core/index_bigkeys_update.js
index dd428b5fd4b..6bdaf033542 100644
--- a/jstests/index_bigkeys_update.js
+++ b/jstests/core/index_bigkeys_update.js
@@ -11,9 +11,7 @@ t.ensureIndex( { x : 1 } );
assert.eq( 1, t.count() );
-t.update( {} , { $set : { x : bigString } } );
-err = db.getLastErrorObj();
-assert( err.err, err );
+assert.writeError(t.update( {} , { $set : { x : bigString } } ));
assert.eq( 1, t.count() );
assert.eq( "asd", t.findOne().x ); // make sure doc is the old version
diff --git a/jstests/index_bounds_number_edge_cases.js b/jstests/core/index_bounds_number_edge_cases.js
index 0ab482028ed..0ab482028ed 100644
--- a/jstests/index_bounds_number_edge_cases.js
+++ b/jstests/core/index_bounds_number_edge_cases.js
diff --git a/jstests/index_check1.js b/jstests/core/index_check1.js
index 7113dff0877..7113dff0877 100644
--- a/jstests/index_check1.js
+++ b/jstests/core/index_check1.js
diff --git a/jstests/index_check2.js b/jstests/core/index_check2.js
index eed3b8e42b7..eed3b8e42b7 100644
--- a/jstests/index_check2.js
+++ b/jstests/core/index_check2.js
diff --git a/jstests/index_check3.js b/jstests/core/index_check3.js
index 55515aff3f5..55515aff3f5 100644
--- a/jstests/index_check3.js
+++ b/jstests/core/index_check3.js
diff --git a/jstests/index_check5.js b/jstests/core/index_check5.js
index eabb929749f..eabb929749f 100644
--- a/jstests/index_check5.js
+++ b/jstests/core/index_check5.js
diff --git a/jstests/index_check6.js b/jstests/core/index_check6.js
index be395fb3d2e..be395fb3d2e 100644
--- a/jstests/index_check6.js
+++ b/jstests/core/index_check6.js
diff --git a/jstests/index_check7.js b/jstests/core/index_check7.js
index 1d0aaebba35..1d0aaebba35 100644
--- a/jstests/index_check7.js
+++ b/jstests/core/index_check7.js
diff --git a/jstests/index_check8.js b/jstests/core/index_check8.js
index 1964ecbe7fc..1964ecbe7fc 100644
--- a/jstests/index_check8.js
+++ b/jstests/core/index_check8.js
diff --git a/jstests/index_diag.js b/jstests/core/index_diag.js
index 21840682e7f..21840682e7f 100644
--- a/jstests/index_diag.js
+++ b/jstests/core/index_diag.js
diff --git a/jstests/index_elemmatch1.js b/jstests/core/index_elemmatch1.js
index 9170ce66018..263eb252364 100644
--- a/jstests/index_elemmatch1.js
+++ b/jstests/core/index_elemmatch1.js
@@ -4,11 +4,13 @@ t.drop()
x = 0
y = 0
+var bulk = t.initializeUnorderedBulkOp();
for ( a=0; a<100; a++ ){
for ( b=0; b<100; b++ ){
- t.insert( { a : a , b : b % 10 , arr : [ { x : x++ % 10 , y : y++ % 10 } ] } )
+ bulk.insert( { a : a , b : b % 10 , arr : [ { x : x++ % 10 , y : y++ % 10 } ] } );
}
}
+assert.writeOK(bulk.execute());
t.ensureIndex( { a : 1 , b : 1 } )
t.ensureIndex( { "arr.x" : 1 , a : 1 } )
diff --git a/jstests/index_filter_commands.js b/jstests/core/index_filter_commands.js
index cec2437fff0..cec2437fff0 100644
--- a/jstests/index_filter_commands.js
+++ b/jstests/core/index_filter_commands.js
diff --git a/jstests/index_many.js b/jstests/core/index_many.js
index 46705a20470..f14f3c3e0fc 100644
--- a/jstests/index_many.js
+++ b/jstests/core/index_many.js
@@ -11,6 +11,7 @@ function f() {
t.save({ x: 19, y : 99 });
x = 2;
+ var lastErr = null;
while (x < 70) {
patt = {};
patt[x] = 1;
@@ -18,12 +19,11 @@ function f() {
patt = { x: 1 };
if (x == 64)
patt = { y: 1 };
- t.ensureIndex(patt);
+ lastErr = t.ensureIndex(patt);
x++;
}
- // print( tojson(db.getLastErrorObj()) );
- assert(db.getLastError(), "should have got an error 'too many indexes'");
+ assert.writeError(lastErr, "should have got an error 'too many indexes'");
// 40 is the limit currently
lim = t.getIndexes().length;
diff --git a/jstests/index_many2.js b/jstests/core/index_many2.js
index f113b8b87ed..f113b8b87ed 100644
--- a/jstests/index_many2.js
+++ b/jstests/core/index_many2.js
diff --git a/jstests/index_sparse1.js b/jstests/core/index_sparse1.js
index eab3c7fec95..fbcc20a9217 100644
--- a/jstests/index_sparse1.js
+++ b/jstests/core/index_sparse1.js
@@ -28,8 +28,7 @@ assert.eq( 1 , t.getIndexes().length , "C3" )
t.remove( { _id : 2 } )
// test that we can't create a unique index without sparse
-t.ensureIndex( { x : 1 } , { unique : 1 } )
-assert( db.getLastError() , "D1" )
+assert.writeError( t.ensureIndex( { x : 1 } , { unique : 1 } ));
assert.eq( 1 , t.getIndexes().length , "D2" )
diff --git a/jstests/index_sparse2.js b/jstests/core/index_sparse2.js
index 56a59db3711..56a59db3711 100644
--- a/jstests/index_sparse2.js
+++ b/jstests/core/index_sparse2.js
diff --git a/jstests/indexa.js b/jstests/core/indexa.js
index 7602183adb2..7602183adb2 100644
--- a/jstests/indexa.js
+++ b/jstests/core/indexa.js
diff --git a/jstests/indexapi.js b/jstests/core/indexapi.js
index 7bc5d45acd3..3e0b70ff15f 100644
--- a/jstests/indexapi.js
+++ b/jstests/core/indexapi.js
@@ -36,5 +36,13 @@ assert.eq( key , idx[1].key , "M2" );
assert( idx[1].unique , "M3" );
//printjson( idx );
-db.system.indexes.insert( { ns : "test" , key : { x : 1 } , name : "x" } );
-assert( db.getLastError() != null , "Z1" );
+// Test that attempting to create index in an invalid namespace fails.
+if (db.getMongo().writeMode() == 'commands') {
+ assert.throws(function() {
+ db.system.indexes.insert( { ns : "test" , key : { x : 1 } , name : "x" } );
+ });
+}
+else {
+ assert.writeError(db.system.indexes.insert( { ns : "test" , key : { x : 1 } , name : "x" } ));
+}
+
diff --git a/jstests/indexb.js b/jstests/core/indexb.js
index d7d2e8c9f05..d7d2e8c9f05 100644
--- a/jstests/indexb.js
+++ b/jstests/core/indexb.js
diff --git a/jstests/indexc.js b/jstests/core/indexc.js
index b099e2d2823..b099e2d2823 100644
--- a/jstests/indexc.js
+++ b/jstests/core/indexc.js
diff --git a/jstests/indexd.js b/jstests/core/indexd.js
index 33246ad9812..33246ad9812 100644
--- a/jstests/indexd.js
+++ b/jstests/core/indexd.js
diff --git a/jstests/indexe.js b/jstests/core/indexe.js
index 213f7c74cf0..e84322c6510 100644
--- a/jstests/indexe.js
+++ b/jstests/core/indexe.js
@@ -2,7 +2,7 @@
t = db.indexe;
t.drop();
-num = 100000;
+var num = 1000;
for ( i=0; i<num; i++){
t.insert( { a : "b" } );
diff --git a/jstests/indexes_on_indexes.js b/jstests/core/indexes_on_indexes.js
index 807c1e25bfd..807c1e25bfd 100644
--- a/jstests/indexes_on_indexes.js
+++ b/jstests/core/indexes_on_indexes.js
diff --git a/jstests/indexf.js b/jstests/core/indexf.js
index d65e7b1c898..d65e7b1c898 100644
--- a/jstests/indexf.js
+++ b/jstests/core/indexf.js
diff --git a/jstests/indexg.js b/jstests/core/indexg.js
index a0709fd6568..a0709fd6568 100644
--- a/jstests/indexg.js
+++ b/jstests/core/indexg.js
diff --git a/jstests/indexh.js b/jstests/core/indexh.js
index ac2a93ec62b..ac2a93ec62b 100644
--- a/jstests/indexh.js
+++ b/jstests/core/indexh.js
diff --git a/jstests/core/indexi.js b/jstests/core/indexi.js
new file mode 100644
index 00000000000..bfd9d13e15c
--- /dev/null
+++ b/jstests/core/indexi.js
@@ -0,0 +1,34 @@
+// Test that client cannot access index namespaces SERVER-4276.
+
+t = db.jstests_indexi;
+t.drop();
+
+idx = db.jstests_indexi.$_id_;
+
+var expectWriteError = function(func) {
+ if (db.getMongo().writeMode() == 'commands') {
+ assert.throws(func);
+ }
+ else {
+ assert.writeError(func());
+ }
+};
+
+// Test that accessing the index namespace fails.
+function checkFailingOperations() {
+ assert.throws(function() { idx.find().itcount(); });
+ expectWriteError(function() { return idx.insert({ x: 1 }); });
+ expectWriteError(function() { return idx.update({ x: 1 }, { x: 2 }); });
+ expectWriteError(function() { return idx.remove({ x: 1 }); });
+ assert.commandFailed( idx.runCommand( 'compact' ) );
+ assert.writeError(idx.ensureIndex({ x: 1 }));
+}
+
+// Check with base collection not present.
+// TODO: SERVER-4276
+//checkFailingOperations();
+t.save({});
+
+// Check with base collection present.
+checkFailingOperations();
+
diff --git a/jstests/indexj.js b/jstests/core/indexj.js
index 6d8ac85c972..6d8ac85c972 100644
--- a/jstests/indexj.js
+++ b/jstests/core/indexj.js
diff --git a/jstests/indexl.js b/jstests/core/indexl.js
index 666586db7a7..666586db7a7 100644
--- a/jstests/indexl.js
+++ b/jstests/core/indexl.js
diff --git a/jstests/indexm.js b/jstests/core/indexm.js
index 6b31ea628cd..6b31ea628cd 100644
--- a/jstests/indexm.js
+++ b/jstests/core/indexm.js
diff --git a/jstests/indexn.js b/jstests/core/indexn.js
index 9abb001eed9..9abb001eed9 100644
--- a/jstests/indexn.js
+++ b/jstests/core/indexn.js
diff --git a/jstests/indexo.js b/jstests/core/indexo.js
index 250b14bbb0e..c9c9424b4ef 100644
--- a/jstests/indexo.js
+++ b/jstests/core/indexo.js
@@ -5,13 +5,11 @@ var coll = db.jstests_indexo;
coll.drop();
// Can create a dropDups index on non-capped collection.
-var response = coll.ensureIndex({x: 1}, {dropDups: true});
-assert(response == null);
+assert.writeOK(coll.ensureIndex({x: 1}, {dropDups: true}));
coll.drop();
// Cannot create a dropDups index on non-capped collection.
db.createCollection("jstests_indexy", {capped: true, size: 1024});
coll = db.jstests_indexy;
-response = coll.ensureIndex({x: 1}, {dropDups: true});
-assert(response != null);
+assert.writeError(coll.ensureIndex({x: 1}, {dropDups: true}));
coll.drop();
diff --git a/jstests/core/indexp.js b/jstests/core/indexp.js
new file mode 100644
index 00000000000..cd72eeeebf5
--- /dev/null
+++ b/jstests/core/indexp.js
@@ -0,0 +1,23 @@
+// Tests that SERVER-11374 is fixed: specifically, that indexes cannot
+// be created on fields that begin with '$' but are not part of DBRefs
+// and that indexes cannot be created on field paths that contain empty
+// fields.
+
+var coll = db.jstests_indexp;
+
+// Empty field checks.
+assert.writeError(coll.ensureIndex({ 'a..b': 1 }));
+assert.writeError(coll.ensureIndex({ '.a': 1 }));
+assert.writeError(coll.ensureIndex({ 'a.': 1 }));
+assert.writeError(coll.ensureIndex({ '.': 1 }));
+assert.writeError(coll.ensureIndex({ '': 1 }));
+assert.writeOK(coll.ensureIndex({ 'a.b': 1 }));
+
+// '$'-prefixed field checks.
+assert.writeError(coll.ensureIndex({ '$a': 1 }));
+assert.writeError(coll.ensureIndex({ 'a.$b': 1 }));
+assert.writeError(coll.ensureIndex({ '$db': 1 }));
+assert.writeOK(coll.ensureIndex({ 'a$ap': 1 })); // $ in middle is ok
+assert.writeOK(coll.ensureIndex({ 'a.$id': 1 })); // $id/$db/$ref are execptions
+
+coll.dropIndexes();
diff --git a/jstests/indexq.js b/jstests/core/indexq.js
index 38cd27b8798..38cd27b8798 100644
--- a/jstests/indexq.js
+++ b/jstests/core/indexq.js
diff --git a/jstests/indexr.js b/jstests/core/indexr.js
index c3eecd045c8..c3eecd045c8 100644
--- a/jstests/indexr.js
+++ b/jstests/core/indexr.js
diff --git a/jstests/indexs.js b/jstests/core/indexs.js
index 609f912affe..609f912affe 100644
--- a/jstests/indexs.js
+++ b/jstests/core/indexs.js
diff --git a/jstests/indext.js b/jstests/core/indext.js
index e418dc2e959..e418dc2e959 100644
--- a/jstests/indext.js
+++ b/jstests/core/indext.js
diff --git a/jstests/indexu.js b/jstests/core/indexu.js
index de0d9831dab..9031d827bf4 100644
--- a/jstests/indexu.js
+++ b/jstests/core/indexu.js
@@ -9,69 +9,53 @@ var dupDoc2 = {a:[{'1':1},'c']};
var noDupDoc = {a:[{'1':1}]};
// Test that we can't index dupDoc.
-t.save( dupDoc );
-assert( !db.getLastError() );
-t.ensureIndex( {'a.0':1} );
-assert( db.getLastError() );
+assert.writeOK( t.save( dupDoc ));
+assert.writeError(t.ensureIndex( {'a.0':1} ));
t.remove({});
-t.ensureIndex( {'a.0':1} );
-assert( !db.getLastError() );
-t.save( dupDoc );
-assert( db.getLastError() );
+assert.writeOK(t.ensureIndex( {'a.0':1} ));
+assert.writeError( t.save( dupDoc ));
// Test that we can't index dupDoc2.
t.drop();
-t.save( dupDoc2 );
-assert( !db.getLastError() );
-t.ensureIndex( {'a.1':1} );
-assert( db.getLastError() );
+assert.writeOK(t.save( dupDoc2 ));
+assert.writeError(t.ensureIndex( {'a.1':1} ));
t.remove({});
-t.ensureIndex( {'a.1':1} );
-assert( !db.getLastError() );
-t.save( dupDoc2 );
-assert( db.getLastError() );
+assert.writeOK(t.ensureIndex( {'a.1':1} ));
+assert.writeError(t.save( dupDoc2 ));
// Test that we can index dupDoc with a different index.
t.drop();
t.ensureIndex( {'a.b':1} );
-t.save( dupDoc );
-assert( !db.getLastError() );
+assert.writeOK(t.save( dupDoc ));
// Test number field starting with hyphen.
t.drop();
t.ensureIndex( {'a.-1':1} );
-t.save( {a:[{'-1':1}]} );
-assert( !db.getLastError() );
+assert.writeOK(t.save( {a:[{'-1':1}]} ));
// Test number field starting with zero.
t.drop();
t.ensureIndex( {'a.00':1} );
-t.save( {a:[{'00':1}]} );
-assert( !db.getLastError() );
+assert.writeOK( t.save( {a:[{'00':1}]} ));
// Test multiple array indexes
t.drop();
t.ensureIndex( {'a.0':1,'a.1':1} );
-t.save( {a:[{'1':1}]} );
-assert( !db.getLastError() );
-t.save( {a:[{'1':1},4]} );
-assert( db.getLastError() );
+assert.writeOK( t.save( {a:[{'1':1}]} ));
+assert.writeError( t.save( {a:[{'1':1},4]} ));
// Test that we can index noDupDoc.
t.drop();
t.save( noDupDoc );
-t.ensureIndex( {'a.0':1} );
-assert( !db.getLastError() );
-t.ensureIndex( {'a.1':1} );
-assert( !db.getLastError() );
+assert.writeOK(t.ensureIndex( {'a.0':1} ));
+assert.writeOK(t.ensureIndex( {'a.1':1} ));
t.drop();
t.ensureIndex( {'a.0':1} );
t.ensureIndex( {'a.1':1} );
-t.save( noDupDoc );
-assert( !db.getLastError() );
+assert.writeOK(t.save( noDupDoc ));
// Test that we can query noDupDoc.
assert.eq( 1, t.find( {'a.1':1} ).hint( {'a.1':1} ).itcount() );
@@ -82,53 +66,40 @@ assert.eq( 1, t.find( {'a.0':{'1':1}} ).hint( {$natural:1} ).itcount() );
// Check multiple nested array fields.
t.drop();
t.save( {a:[[1]]} );
-t.ensureIndex( {'a.0.0':1} );
-assert( !db.getLastError() );
+assert.writeOK(t.ensureIndex( {'a.0.0':1} ));
assert.eq( 1, t.find( {'a.0.0':1} ).hint( {$natural:1} ).itcount() );
assert.eq( 1, t.find( {'a.0.0':1} ).hint( {'a.0.0':1} ).itcount() );
// Check where there is a duplicate for a partially addressed field but not for a fully addressed field.
t.drop();
t.save( {a:[[1],{'0':1}]} );
-t.ensureIndex( {'a.0.0':1} );
-assert( db.getLastError() );
+assert.writeError(t.ensureIndex( {'a.0.0':1} ));
// Check where there is a duplicate for a fully addressed field.
t.drop();
-t.save( {a:[[1],{'0':[1]}]} );
-assert( !db.getLastError() );
-t.ensureIndex( {'a.0.0':1} );
-assert( db.getLastError() );
+assert.writeOK( t.save( {a:[[1],{'0':[1]}]} ));
+assert.writeError(t.ensureIndex( {'a.0.0':1} ));
// Two ways of addressing parse to an array.
t.drop();
t.save( {a:[{'0':1}]} );
-t.ensureIndex( {'a.0.0':1} );
-assert( db.getLastError() );
+assert.writeError(t.ensureIndex( {'a.0.0':1} ));
// Test several key depths - with same arrays being found.
t.drop();
t.save( {a:[{'0':[{'0':1}]}]} );
-t.ensureIndex( {'a.0.0.0.0.0.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a.0.0.0.0.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a.0.0.0.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a.0.0.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a.0.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a.0':1} );
-assert( db.getLastError() );
-t.ensureIndex( {'a':1} );
-assert( !db.getLastError() );
+assert.writeError(t.ensureIndex( {'a.0.0.0.0.0.0':1} ));
+assert.writeError(t.ensureIndex( {'a.0.0.0.0.0':1} ));
+assert.writeError(t.ensureIndex( {'a.0.0.0.0':1} ));
+assert.writeError(t.ensureIndex( {'a.0.0.0':1} ));
+assert.writeError(t.ensureIndex( {'a.0.0':1} ));
+assert.writeError(t.ensureIndex( {'a.0':1} ));
+assert.writeOK(t.ensureIndex( {'a':1} ));
// Two prefixes extract docs, but one terminates extraction before array.
t.drop();
t.save( {a:[{'0':{'c':[]}}]} );
-t.ensureIndex( {'a.0.c':1} );
-assert( db.getLastError() );
+assert.writeError(t.ensureIndex( {'a.0.c':1} ));
t.drop();
t.save( {a:[[{'b':1}]]} );
diff --git a/jstests/indexv.js b/jstests/core/indexv.js
index 334ec432d74..334ec432d74 100644
--- a/jstests/indexv.js
+++ b/jstests/core/indexv.js
diff --git a/jstests/indexw.js b/jstests/core/indexw.js
index bd7c75b8b08..bd7c75b8b08 100644
--- a/jstests/indexw.js
+++ b/jstests/core/indexw.js
diff --git a/jstests/core/insert1.js b/jstests/core/insert1.js
new file mode 100644
index 00000000000..e4ce6a4e10e
--- /dev/null
+++ b/jstests/core/insert1.js
@@ -0,0 +1,34 @@
+t = db.insert1;
+t.drop();
+
+var o = {a:1};
+t.insert(o);
+var doc = t.findOne();
+assert.eq(1, doc.a);
+assert(doc._id != null, tojson(doc));
+
+t.drop();
+o = {a:2, _id:new ObjectId()};
+var id = o._id;
+t.insert(o);
+doc = t.findOne();
+assert.eq(2, doc.a);
+assert.eq(id, doc._id);
+
+t.drop();
+o = {a:3, _id:"asdf"};
+id = o._id;
+t.insert(o);
+doc = t.findOne();
+assert.eq(3, doc.a);
+assert.eq(id, doc._id);
+
+t.drop();
+o = {a:4, _id:null};
+t.insert(o);
+doc = t.findOne();
+assert.eq(4, doc.a);
+assert.eq(null, doc._id, tojson(doc));
+
+var stats = db.runCommand({ collstats: "insert1" });
+assert(stats.paddingFactor == 1.0);
diff --git a/jstests/core/insert2.js b/jstests/core/insert2.js
new file mode 100644
index 00000000000..8ce4b25c25f
--- /dev/null
+++ b/jstests/core/insert2.js
@@ -0,0 +1,13 @@
+// Create a new connection object so it won't affect the global connection when we modify
+// it's settings.
+var conn = new Mongo(db.getMongo().host);
+conn._skipValidation = true;
+conn.forceWriteMode(db.getMongo().writeMode());
+
+t = conn.getDB(db.getName()).insert2;
+t.drop();
+
+assert.isnull( t.findOne() , "A" )
+assert.writeError(t.insert( { z : 1 , $inc : { x : 1 } } , 0, true ));
+assert.isnull( t.findOne() , "B" )
+
diff --git a/jstests/insert_id_undefined.js b/jstests/core/insert_id_undefined.js
index 945640a815b..77d7d983549 100644
--- a/jstests/insert_id_undefined.js
+++ b/jstests/core/insert_id_undefined.js
@@ -2,5 +2,4 @@
t = db.insert_id_undefined;
t.drop();
t.insert({_id:undefined});
-db.getLastError();
assert.eq(t.count(), 0);
diff --git a/jstests/insert_illegal_doc.js b/jstests/core/insert_illegal_doc.js
index 2b4d326e9ce..2b4d326e9ce 100644
--- a/jstests/insert_illegal_doc.js
+++ b/jstests/core/insert_illegal_doc.js
diff --git a/jstests/insert_long_index_key.js b/jstests/core/insert_long_index_key.js
index 6379c36fb4a..6379c36fb4a 100644
--- a/jstests/insert_long_index_key.js
+++ b/jstests/core/insert_long_index_key.js
diff --git a/jstests/ismaster.js b/jstests/core/ismaster.js
index 0c385b02d7c..0c385b02d7c 100644
--- a/jstests/ismaster.js
+++ b/jstests/core/ismaster.js
diff --git a/jstests/fts_partition_no_multikey.js b/jstests/fts_partition_no_multikey.js
deleted file mode 100644
index a6320cc4a9e..00000000000
--- a/jstests/fts_partition_no_multikey.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-t = db.fts_partition_no_multikey;
-t.drop();
-
-t.ensureIndex( { x : 1, y : "text" } )
-
-t.insert( { x : 5 , y : "this is fun" } );
-assert.isnull( db.getLastError() );
-
-t.insert( { x : [] , y : "this is fun" } );
-assert( db.getLastError() );
-
-t.insert( { x : [1] , y : "this is fun" } );
-assert( db.getLastError() );
-
-t.insert( { x : [1,2] , y : "this is fun" } );
-assert( db.getLastError() );
diff --git a/jstests/geo10.js b/jstests/geo10.js
deleted file mode 100644
index 39da09fb9ef..00000000000
--- a/jstests/geo10.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// Test for SERVER-2746
-
-coll = db.geo10
-coll.drop();
-
-db.geo10.ensureIndex( { c : '2d', t : 1 }, { min : 0, max : Math.pow( 2, 40 ) } )
-assert( db.getLastError() == null, "B" )
-assert( db.system.indexes.count({ ns : "test.geo10" }) == 2, "A3" )
-
-printjson( db.system.indexes.find().toArray() )
-
-db.geo10.insert( { c : [ 1, 1 ], t : 1 } )
-assert.eq( db.getLastError(), null, "C" )
-
-db.geo10.insert( { c : [ 3600, 3600 ], t : 1 } )
-assert( db.getLastError() == null, "D" )
-
-db.geo10.insert( { c : [ 0.001, 0.001 ], t : 1 } )
-assert( db.getLastError() == null, "E" )
-
-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/geo4.js b/jstests/geo4.js
deleted file mode 100644
index 78404ab720c..00000000000
--- a/jstests/geo4.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var t = db.geo4;
-t.drop();
-
-t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } );
-
-t.ensureIndex( { loc : "2d" }, { bits : 33 } );
-assert.eq( db.getLastError() , "bits in geo index must be between 1 and 32" , "a" );
-
-t.ensureIndex( { loc : "2d" }, { bits : 32 } );
-assert( !db.getLastError(), "b" );
diff --git a/jstests/geo_center_sphere2.js b/jstests/geo_center_sphere2.js
deleted file mode 100644
index 5e17790e668..00000000000
--- a/jstests/geo_center_sphere2.js
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// Tests the error handling of spherical queries
-// along with multi-location documents.
-// This is necessary since the error handling must manage
-// multiple documents, and so requires simultaneous testing.
-//
-
-function deg2rad(arg) { return arg * Math.PI / 180.0; }
-function rad2deg(arg) { return arg * 180.0 / Math.PI; }
-
-function computexscandist(y, maxDistDegrees) {
- return maxDistDegrees / Math.min(Math.cos(deg2rad(Math.min(89.0, y + maxDistDegrees))),
- Math.cos(deg2rad(Math.max(-89.0, y - maxDistDegrees))));
-}
-
-function pointIsOK(startPoint, radius) {
- yscandist = rad2deg(radius) + 0.01;
- xscandist = computexscandist(startPoint[1], yscandist);
- return (startPoint[0] + xscandist < 180)
- && (startPoint[0] - xscandist > -180)
- && (startPoint[1] + yscandist < 90)
- && (startPoint[1] - yscandist > -90);
-}
-
-var numTests = 30
-
-for ( var test = 0; test < numTests; test++ ) {
-
- //var fixedTest = 6017
- //if( fixedTest ) test = fixedTest
-
- Random.srand( 1337 + test );
-
- var radius = 5000 * Random.rand() // km
- radius = radius / 6371 // radians
- var numDocs = Math.floor( 400 * Random.rand() )
- // TODO: Wrapping uses the error value to figure out what would overlap...
- var bits = Math.floor( 5 + Random.rand() * 28 )
- var maxPointsPerDoc = 50
-
- t = db.sphere
-
- var randomPoint = function() {
- return [ Random.rand() * 360 - 180, Random.rand() * 180 - 90 ];
- }
-
- // Get a start point that doesn't require wrapping
- // TODO: Are we a bit too aggressive with wrapping issues?
- var startPoint
- var ex = null
- do {
- t.drop()
- startPoint = randomPoint()
- t.ensureIndex( { loc : "2d" }, { bits : bits } )
- } while (!pointIsOK(startPoint, radius))
-
- var pointsIn = 0
- var pointsOut = 0
- var docsIn = 0
- var docsOut = 0
- var totalPoints = 0
-
- for ( var i = 0; i < numDocs; i++ ) {
-
- var numPoints = Math.floor( Random.rand() * maxPointsPerDoc + 1 )
- var docIn = false
- var multiPoint = []
-
- totalPoints += numPoints
-
- for ( var p = 0; p < numPoints; p++ ) {
- var point = randomPoint()
- multiPoint.push( point )
-
- if ( Geo.sphereDistance( startPoint, point ) <= radius ) {
- pointsIn++
- docIn = true
- } else {
- pointsOut++
- }
- }
-
- t.insert( { loc : multiPoint } )
-
- if ( docIn )
- docsIn++
- else
- docsOut++
-
- }
-
- printjson( { test: test,
- radius : radius, bits : bits, numDocs : numDocs, pointsIn : pointsIn, docsIn : docsIn, pointsOut : pointsOut,
- docsOut : docsOut } )
-
- assert.isnull( db.getLastError() )
- assert.eq( docsIn + docsOut, numDocs )
- assert.eq( pointsIn + pointsOut, totalPoints )
-
- // $centerSphere
- assert.eq( docsIn, t.find( { loc : { $within : { $centerSphere : [ startPoint, radius ] } } } ).count() )
-
- // $nearSphere
- var results = t.find( { loc : { $nearSphere : startPoint, $maxDistance : radius } } ).limit( 2 * pointsIn )
- .toArray()
-
- assert.eq( docsIn, results.length )
-
- var distance = 0;
- for ( var i = 0; i < results.length; i++ ) {
-
- var minNewDistance = radius + 1
- for( var j = 0; j < results[i].loc.length; j++ ){
- var newDistance = Geo.sphereDistance( startPoint, results[i].loc[j] )
- if( newDistance < minNewDistance && newDistance >= distance ) minNewDistance = newDistance
- }
-
- //print( "Dist from : " + results[i].loc[j] + " to " + startPoint + " is "
- // + minNewDistance + " vs " + radius )
-
- assert.lte( minNewDistance, radius )
- assert.gte( minNewDistance, distance )
- distance = minNewDistance
-
- }
-
- // geoNear
- var results = db.runCommand( {
- geoNear : "sphere", near : startPoint, maxDistance : radius, num : 2 * pointsIn, spherical : true } ).results
-
- /*
- printjson( results );
-
- for ( var j = 0; j < results[0].obj.loc.length; j++ ) {
- var newDistance = Geo.sphereDistance( startPoint, results[0].obj.loc[j] )
- if( newDistance <= radius ) print( results[0].obj.loc[j] + " : " + newDistance )
- }
- */
-
- assert.eq( docsIn, results.length )
-
- var distance = 0;
- for ( var i = 0; i < results.length; i++ ) {
- var retDistance = results[i].dis
-
- // print( "Dist from : " + results[i].loc + " to " + startPoint + " is "
- // + retDistance + " vs " + radius )
-
- var distInObj = false
- for ( var j = 0; j < results[i].obj.loc.length && distInObj == false; j++ ) {
- var newDistance = Geo.sphereDistance( startPoint, results[i].obj.loc[j] )
- distInObj = ( newDistance >= retDistance - 0.0001 && newDistance <= retDistance + 0.0001 )
- }
-
- assert( distInObj )
- assert.lte( retDistance, radius )
- assert.gte( retDistance, distance )
- distance = retDistance
- }
-
- //break;
-}
-
-
diff --git a/jstests/geo_oob_sphere.js b/jstests/geo_oob_sphere.js
deleted file mode 100644
index f2c76457af9..00000000000
--- a/jstests/geo_oob_sphere.js
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Ensures spherical queries report invalid latitude values in points and center positions
-//
-
-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.ensureIndex({ loc : "2d" })
-assert.isnull( db.getLastError() )
-
-assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count() } );
-var err = db.getLastError()
-assert( err != null )
-printjson( err )
-
-assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 89 ], $maxDistance : 0.25 } }).count() } );
-var err = db.getLastError()
-assert( err != null )
-printjson( err )
-
-assert.throws( function() { t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count() } );
-var err = db.getLastError()
-assert( err != null )
-printjson( err )
-
-db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true })
-var err = db.getLastError()
-assert( err != null )
-printjson( err )
-
-db.runCommand({ geoNear : "geooobsphere", near : [30, 89], maxDistance : 0.25, spherical : true })
-var err = db.getLastError()
-assert( err != null )
-printjson( err ) \ No newline at end of file
diff --git a/jstests/geo_polygon2.js b/jstests/geo_polygon2.js
deleted file mode 100644
index 617801bfc7b..00000000000
--- a/jstests/geo_polygon2.js
+++ /dev/null
@@ -1,266 +0,0 @@
-//
-// More tests for N-dimensional polygon querying
-//
-
-// Create a polygon of some shape (no holes)
-// using turtle graphics. Basically, will look like a very contorted octopus (quad-pus?) shape.
-// There are no holes, but some edges will probably touch.
-
-var numTests = 10
-
-for ( var test = 0; test < numTests; test++ ) {
-
- Random.srand( 1337 + test );
-
- var numTurtles = 4;
- var gridSize = [ 40, 40 ];
- var turtleSteps = 500;
- var bounds = [ Random.rand() * -1000000 + 0.00001, Random.rand() * 1000000 + 0.00001 ]
- var rotation = Math.PI * Random.rand();
- var bits = Math.floor( Random.rand() * 32 );
-
- printjson( { test : test, rotation : rotation, bits : bits })
-
- var rotatePoint = function( x, y ) {
-
- if( y == undefined ){
- y = x[1]
- x = x[0]
- }
-
- xp = x * Math.cos( rotation ) - y * Math.sin( rotation )
- yp = y * Math.cos( rotation ) + x * Math.sin( rotation )
-
- var scaleX = (bounds[1] - bounds[0]) / 360
- var scaleY = (bounds[1] - bounds[0]) / 360
-
- x *= scaleX
- y *= scaleY
-
- return [xp, yp]
-
- }
-
-
- var grid = []
- for ( var i = 0; i < gridSize[0]; i++ ) {
- grid.push( new Array( gridSize[1] ) )
- }
-
- grid.toString = function() {
-
- var gridStr = "";
- for ( var j = grid[0].length - 1; j >= -1; j-- ) {
- for ( var i = 0; i < grid.length; i++ ) {
- if ( i == 0 )
- gridStr += ( j == -1 ? " " : ( j % 10) ) + ": "
- if ( j != -1 )
- gridStr += "[" + ( grid[i][j] != undefined ? grid[i][j] : " " ) + "]"
- else
- gridStr += " " + ( i % 10 ) + " "
- }
- gridStr += "\n"
- }
-
- return gridStr;
- }
-
- var turtles = []
- for ( var i = 0; i < numTurtles; i++ ) {
-
- var up = ( i % 2 == 0 ) ? i - 1 : 0;
- var left = ( i % 2 == 1 ) ? ( i - 1 ) - 1 : 0;
-
- turtles[i] = [
- [ Math.floor( gridSize[0] / 2 ), Math.floor( gridSize[1] / 2 ) ],
- [ Math.floor( gridSize[0] / 2 ) + left, Math.floor( gridSize[1] / 2 ) + up ] ];
-
- grid[turtles[i][1][0]][turtles[i][1][1]] = i
-
- }
-
- grid[Math.floor( gridSize[0] / 2 )][Math.floor( gridSize[1] / 2 )] = "S"
-
- // print( grid.toString() )
-
- var pickDirections = function() {
-
- var up = Math.floor( Random.rand() * 3 )
- if ( up == 2 )
- up = -1
-
- if ( up == 0 ) {
- var left = Math.floor( Random.rand() * 3 )
- if ( left == 2 )
- left = -1
- } else
- left = 0
-
- if ( Random.rand() < 0.5 ) {
- var swap = left
- left = up
- up = swap
- }
-
- return [ left, up ]
- }
-
- for ( var s = 0; s < turtleSteps; s++ ) {
-
- for ( var t = 0; t < numTurtles; t++ ) {
-
- var dirs = pickDirections()
- var up = dirs[0]
- var left = dirs[1]
-
- var lastTurtle = turtles[t][turtles[t].length - 1]
- var nextTurtle = [ lastTurtle[0] + left, lastTurtle[1] + up ]
-
- if ( nextTurtle[0] >= gridSize[0] || nextTurtle[1] >= gridSize[1] || nextTurtle[0] < 0 || nextTurtle[1] < 0 )
- continue;
-
- if ( grid[nextTurtle[0]][nextTurtle[1]] == undefined ) {
- turtles[t].push( nextTurtle )
- grid[nextTurtle[0]][nextTurtle[1]] = t;
- }
-
- }
- }
-
- // print( grid.toString() )
-
- turtlePaths = []
- for ( var t = 0; t < numTurtles; t++ ) {
-
- turtlePath = []
-
- var nextSeg = function(currTurtle, prevTurtle) {
-
- var pathX = currTurtle[0]
-
- if ( currTurtle[1] < prevTurtle[1] ) {
- pathX = currTurtle[0] + 1
- pathY = prevTurtle[1]
- } else if ( currTurtle[1] > prevTurtle[1] ) {
- pathX = currTurtle[0]
- pathY = currTurtle[1]
- } else if ( currTurtle[0] < prevTurtle[0] ) {
- pathX = prevTurtle[0]
- pathY = currTurtle[1]
- } else if ( currTurtle[0] > prevTurtle[0] ) {
- pathX = currTurtle[0]
- pathY = currTurtle[1] + 1
- }
-
- // print( " Prev : " + prevTurtle + " Curr : " + currTurtle + " path
- // : "
- // + [pathX, pathY]);
-
- return [ pathX, pathY ]
- }
-
- for ( var s = 1; s < turtles[t].length; s++ ) {
-
- currTurtle = turtles[t][s]
- prevTurtle = turtles[t][s - 1]
-
- turtlePath.push( nextSeg( currTurtle, prevTurtle ) )
-
- }
-
- for ( var s = turtles[t].length - 2; s >= 0; s-- ) {
-
- currTurtle = turtles[t][s]
- prevTurtle = turtles[t][s + 1]
-
- turtlePath.push( nextSeg( currTurtle, prevTurtle ) )
-
- }
-
- // printjson( turtlePath )
-
- // End of the line is not inside our polygon.
- var lastTurtle = turtles[t][turtles[t].length - 1]
- grid[lastTurtle[0]][lastTurtle[1]] = undefined
-
- fixedTurtlePath = []
- for ( var s = 1; s < turtlePath.length; s++ ) {
-
- if ( turtlePath[s - 1][0] == turtlePath[s][0] && turtlePath[s - 1][1] == turtlePath[s][1] )
- continue;
-
- var up = turtlePath[s][1] - turtlePath[s - 1][1]
- var right = turtlePath[s][0] - turtlePath[s - 1][0]
- var addPoint = ( up != 0 && right != 0 )
-
- if ( addPoint && up != right ) {
- fixedTurtlePath.push( [ turtlePath[s][0], turtlePath[s - 1][1] ] )
- } else if ( addPoint ) {
- fixedTurtlePath.push( [ turtlePath[s - 1][0], turtlePath[s][1] ] )
- }
-
- fixedTurtlePath.push( turtlePath[s] )
-
- }
-
- // printjson( fixedTurtlePath )
-
- turtlePaths.push( fixedTurtlePath )
-
- }
-
- // Uncomment to print polygon shape
- // print( grid.toString() )
-
- var polygon = []
- for ( var t = 0; t < turtlePaths.length; t++ ) {
- for ( var s = 0; s < turtlePaths[t].length; s++ ) {
- polygon.push( rotatePoint( turtlePaths[t][s] ) )
- }
- }
-
- // Uncomment to print out polygon
- // printjson( polygon )
-
- t = db.polytest2
- t.drop()
-
- // Test single and multi-location documents
- var pointsIn = 0
- var pointsOut = 0
- var allPointsIn = []
- var allPointsOut = []
-
- for ( var j = grid[0].length - 1; j >= 0; j-- ) {
- for ( var i = 0; i < grid.length; i++ ) {
-
- var point = rotatePoint( [ i + 0.5, j + 0.5 ] )
-
- t.insert( { loc : point } )
- if ( grid[i][j] != undefined ){
- allPointsIn.push( point )
- pointsIn++
- }
- else{
- allPointsOut.push( point )
- pointsOut++
- }
- }
- }
-
- t.ensureIndex( { loc : "2d" }, { bits : 1 + bits, max : bounds[1], min : bounds[0] } )
- assert.isnull( db.getLastError() )
-
- t.insert( { loc : allPointsIn } )
- t.insert( { loc : allPointsOut } )
- allPoints = allPointsIn.concat( allPointsOut )
- t.insert( { loc : allPoints } )
-
- print( "Points : " )
- printjson( { pointsIn : pointsIn, pointsOut : pointsOut } )
- //print( t.find( { loc : { "$within" : { "$polygon" : polygon } } } ).count() )
-
- assert.eq( gridSize[0] * gridSize[1] + 3, t.find().count() )
- assert.eq( 2 + pointsIn, t.find( { loc : { "$within" : { "$polygon" : polygon } } } ).count() );
-
-}
diff --git a/jstests/geo_small_large.js b/jstests/geo_small_large.js
deleted file mode 100644
index aff4743fc71..00000000000
--- a/jstests/geo_small_large.js
+++ /dev/null
@@ -1,151 +0,0 @@
-// SERVER-2386, general geo-indexing using very large and very small bounds
-
-load( "jstests/libs/geo_near_random.js" );
-
-// Do some random tests (for near queries) with very large and small ranges
-
-var test = new GeoNearRandomTest( "geo_small_large" );
-
-bounds = { min : -Math.pow( 2, 34 ), max : Math.pow( 2, 34 ) };
-
-test.insertPts( 50, bounds );
-
-printjson( db["geo_small_large"].find().limit( 10 ).toArray() )
-
-test.testPt( [ 0, 0 ] );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-
-test = new GeoNearRandomTest( "geo_small_large" );
-
-bounds = { min : -Math.pow( 2, -34 ), max : Math.pow( 2, -34 ) };
-
-test.insertPts( 50, bounds );
-
-printjson( db["geo_small_large"].find().limit( 10 ).toArray() )
-
-test.testPt( [ 0, 0 ] );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-test.testPt( test.mkPt( undefined, bounds ) );
-
-
-// Check that our box and circle queries also work
-var scales = [ Math.pow( 2, 40 ), Math.pow( 2, -40 ), Math.pow(2, 2), Math.pow(3, -15), Math.pow(3, 15) ]
-
-for ( var i = 0; i < scales.length; i++ ) {
-
- scale = scales[i];
-
- var eps = Math.pow( 2, -7 ) * scale;
- var radius = 5 * scale;
- var max = 10 * scale;
- var min = -max;
- var range = max - min;
- var bits = 2 + Math.random() * 30
-
- var t = db["geo_small_large"]
- t.drop();
- t.ensureIndex( { p : "2d" }, { min : min, max : max, bits : bits })
-
- var outPoints = 0;
- var inPoints = 0;
-
- printjson({ eps : eps, radius : radius, max : max, min : min, range : range, bits : bits })
-
- // Put a point slightly inside and outside our range
- for ( var j = 0; j < 2; j++ ) {
- var currRad = ( j % 2 == 0 ? radius + eps : radius - eps );
- t.insert( { p : { x : currRad, y : 0 } } );
- print( db.getLastError() )
- }
-
- printjson( t.find().toArray() );
-
- assert.eq( t.count( { p : { $within : { $center : [[0, 0], radius ] } } } ), 1, "Incorrect center points found!" )
- assert.eq( t.count( { p : { $within : { $box : [ [ -radius, -radius ], [ radius, radius ] ] } } } ), 1,
- "Incorrect box points found!" )
-
- shouldFind = []
- randoms = []
-
- for ( var j = 0; j < 2; j++ ) {
-
- var randX = Math.random(); // randoms[j].randX
- var randY = Math.random(); // randoms[j].randY
-
- randoms.push({ randX : randX, randY : randY })
-
- var x = randX * ( range - eps ) + eps + min;
- var y = randY * ( range - eps ) + eps + min;
-
- t.insert( { p : [ x, y ] } );
-
- if ( x * x + y * y > radius * radius ){
- // print( "out point ");
- // printjson({ x : x, y : y })
- outPoints++
- }
- else{
- // print( "in point ");
- // printjson({ x : x, y : y })
- inPoints++
- shouldFind.push({ x : x, y : y, radius : Math.sqrt( x * x + y * y ) })
- }
- }
-
- /*
- function printDiff( didFind, shouldFind ){
-
- for( var i = 0; i < shouldFind.length; i++ ){
- var beenFound = false;
- for( var j = 0; j < didFind.length && !beenFound ; j++ ){
- beenFound = shouldFind[i].x == didFind[j].x &&
- shouldFind[i].y == didFind[j].y
- }
-
- if( !beenFound ){
- print( "Could not find: " )
- shouldFind[i].inRadius = ( radius - shouldFind[i].radius >= 0 )
- printjson( shouldFind[i] )
- }
- }
- }
-
- print( "Finding random pts... ")
- var found = t.find( { p : { $within : { $center : [[0, 0], radius ] } } } ).toArray()
- var didFind = []
- for( var f = 0; f < found.length; f++ ){
- //printjson( found[f] )
- var x = found[f].p.x != undefined ? found[f].p.x : found[f].p[0]
- var y = found[f].p.y != undefined ? found[f].p.y : found[f].p[1]
- didFind.push({ x : x, y : y, radius : Math.sqrt( x * x + y * y ) })
- }
-
- print( "Did not find but should: ")
- printDiff( didFind, shouldFind )
- print( "Found but should not have: ")
- printDiff( shouldFind, didFind )
- */
-
- assert.eq( t.count( { p : { $within : { $center : [[0, 0], radius ] } } } ), 1 + inPoints,
- "Incorrect random center points found!\n" + tojson( randoms ) )
-
- print("Found " + inPoints + " points in and " + outPoints + " points out.");
-
- var found = t.find( { p : { $near : [0, 0], $maxDistance : radius } } ).toArray()
- var dist = 0;
- for( var f = 0; f < found.length; f++ ){
- var x = found[f].p.x != undefined ? found[f].p.x : found[f].p[0]
- var y = found[f].p.y != undefined ? found[f].p.y : found[f].p[1]
- print( "Dist: x : " + x + " y : " + y + " dist : " + Math.sqrt( x * x + y * y) + " radius : " + radius )
- }
-
- assert.eq( t.count( { p : { $near : [0, 0], $maxDistance : radius } } ), 1 + inPoints,
- "Incorrect random center points found near!\n" + tojson( randoms ) )
-
-}
-
diff --git a/jstests/indexbindata.js b/jstests/indexbindata.js
deleted file mode 100755
index e69de29bb2d..00000000000
--- a/jstests/indexbindata.js
+++ /dev/null
diff --git a/jstests/indexi.js b/jstests/indexi.js
deleted file mode 100644
index 446d6a21fc5..00000000000
--- a/jstests/indexi.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// Test that client cannot access index namespaces SERVER-4276.
-
-if ( 0 ) { // SERVER-4276
-
-t = db.jstests_indexi;
-t.drop();
-
-debug = true;
-
-idx = db.jstests_indexi.$_id_;
-
-function shouldFail( f ) {
- e = assert.throws( function() {
- f();
- if( db.getLastError() ) {
- throw db.getLastError();
- }
- } );
- if ( debug ) {
- printjson( e );
- }
-}
-
-function checkFailingOperations() {
- // Test that accessing the index namespace fails.
- shouldFail( function() { idx.count(); } );
- shouldFail( function() { idx.find().itcount(); } );
- shouldFail( function() { idx.insert({}); } );
- shouldFail( function() { idx.remove({}); } );
- shouldFail( function() { idx.update({},{}); } );
- assert.commandFailed( idx.runCommand( 'compact' ) );
-
- // No validation here (yet).
- //shouldFail( function() { idx.ensureIndex({x:1}) } );
-}
-
-// Check with base collection not present.
-checkFailingOperations();
-t.save({});
-// Check with base collection present.
-checkFailingOperations();
-
-}
diff --git a/jstests/indexp.js b/jstests/indexp.js
deleted file mode 100644
index d71de4716a7..00000000000
--- a/jstests/indexp.js
+++ /dev/null
@@ -1,54 +0,0 @@
-// Tests that SERVER-11374 is fixed: specifically, that indexes cannot
-// be created on fields that begin with '$' but are not part of DBRefs
-// and that indexes cannot be created on field paths that contain empty
-// fields.
-
-var coll = db.jstests_indexp;
-
-// Empty field checks.
-coll.ensureIndex({ 'a..b': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on 'a..b' was created successfully." );
-
-coll.ensureIndex({ '.a': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on '.a' was created successfully." );
-
-coll.ensureIndex({ 'a.': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on 'a.' was created successfully." );
-
-coll.ensureIndex({ '.': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on '.' was created successfully." );
-
-coll.ensureIndex({ '': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on '' was created successfully." );
-
-coll.ensureIndex({ 'a.b': 1 });
-assert( db.getLastError() == null,
- "Expected no error, but creating index on 'a.b' failed." );
-
-// '$'-prefixed field checks.
-coll.ensureIndex({ '$a': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on '$a' was created successfully." );
-
-coll.ensureIndex({ 'a.$b': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on 'a.$b' was created successfully." );
-
-coll.ensureIndex({ 'a$ap': 1 });
-assert( db.getLastError() == null,
- "Expected no error, but creating index on 'a$ap' failed." );
-
-coll.ensureIndex({ '$db': 1 });
-assert( db.getLastError() != null,
- "Expected error, but index on '$db' was created successfully." );
-
-coll.ensureIndex({ 'a.$id': 1 });
-assert( db.getLastError() == null,
- "Expected no error, but creating index on 'a.$id' failed." );
-
-coll.dropIndexes();
diff --git a/jstests/insert1.js b/jstests/insert1.js
deleted file mode 100644
index 7e6b73b6566..00000000000
--- a/jstests/insert1.js
+++ /dev/null
@@ -1,44 +0,0 @@
-t = db.insert1;
-t.drop();
-
-o = {a:1};
-t.insert(o);
-id = t._lastID
-assert.eq(o, {a:1}, "input unchanged 1");
-assert.eq(typeof(id), "object", "1");
-assert.eq(id.constructor, ObjectId, "1");
-assert.eq(t.findOne({_id:id}).a, 1, "find by id 1");
-assert.eq(t.findOne({a:1})._id, id , "find by val 1");
-
-o = {a:2, _id:new ObjectId()};
-id1 = o._id
-t.insert(o);
-id2 = t._lastID
-assert.eq(id1, id2, "ids match 2");
-assert.eq(o, {a:2, _id:id1}, "input unchanged 2");
-assert.eq(typeof(id2), "object", "2");
-assert.eq(id2.constructor, ObjectId, "2");
-assert.eq(t.findOne({_id:id1}).a, 2, "find by id 2");
-assert.eq(t.findOne({a:2})._id, id1 , "find by val 2");
-
-o = {a:3, _id:"asdf"};
-id1 = o._id
-t.insert(o);
-id2 = t._lastID
-assert.eq(id1, id2, "ids match 3");
-assert.eq(o, {a:3, _id:id1}, "input unchanged 3");
-assert.eq(typeof(id2), "string", "3");
-assert.eq(t.findOne({_id:id1}).a, 3, "find by id 3");
-assert.eq(t.findOne({a:3})._id, id1 , "find by val 3");
-
-o = {a:4, _id:null};
-id1 = o._id
-t.insert(o);
-id2 = t._lastID
-assert.eq(id1, id2, "ids match 4");
-assert.eq(o, {a:4, _id:id1}, "input unchanged 4");
-assert.eq(t.findOne({_id:id1}).a, 4, "find by id 4");
-assert.eq(t.findOne({a:4})._id, id1 , "find by val 4");
-
-var stats = db.runCommand({ collstats: "insert1" });
-assert(stats.paddingFactor == 1.0);
diff --git a/jstests/insert2.js b/jstests/insert2.js
deleted file mode 100644
index 9480efeac4d..00000000000
--- a/jstests/insert2.js
+++ /dev/null
@@ -1,8 +0,0 @@
-
-t = db.insert2
-t.drop()
-
-assert.isnull( t.findOne() , "A" )
-t.insert( { z : 1 , $inc : { x : 1 } } , 0, true );
-assert.isnull( t.findOne() , "B" )
-
diff --git a/jstests/slowNightly/sharding_jscore_passthrough.js b/jstests/slowNightly/sharding_jscore_passthrough.js
index e6f36d74ae2..0d164c6e92c 100644
--- a/jstests/slowNightly/sharding_jscore_passthrough.js
+++ b/jstests/slowNightly/sharding_jscore_passthrough.js
@@ -1,7 +1,10 @@
var myShardingTest = new ShardingTest("sharding_passthrough", 2, 0, 1);
myShardingTest.adminCommand({ enablesharding : "test" });
+
var db = myShardingTest.getDB("test");
db.getMongo().forceWriteMode("commands");
+_useWriteCommandsDefault = function() { return true; }; // for tests launching parallel shells.
+
var res = db.adminCommand({ setParameter: 1, useClusterWriteCommands: true });
var files = listFiles("jstests/core");