summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2014-02-19 12:45:53 -0500
committerMatt Kangas <matt.kangas@mongodb.com>2014-03-03 22:54:10 -0500
commit3660343e0b4627d2fee4afb89b74d32644d16d18 (patch)
treeffa571e0b73ce56d73c2ae23f458f0db772ef782 /jstests
parent9fae141a1f3fe652fa6002e47722c5ceb051cffb (diff)
downloadmongo-3660343e0b4627d2fee4afb89b74d32644d16d18.tar.gz
SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z. Include SERVER-12920 Update use_power_of_2.js Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/js1.js (renamed from jstests/js1.js)0
-rw-r--r--jstests/core/js2.js (renamed from jstests/js2.js)0
-rw-r--r--jstests/core/js3.js (renamed from jstests/js3.js)0
-rw-r--r--jstests/core/js4.js (renamed from jstests/js4.js)0
-rw-r--r--jstests/core/js5.js (renamed from jstests/js5.js)0
-rw-r--r--jstests/core/js7.js (renamed from jstests/js7.js)0
-rw-r--r--jstests/core/js8.js (renamed from jstests/js8.js)0
-rw-r--r--jstests/core/js9.js (renamed from jstests/js9.js)0
-rw-r--r--jstests/core/json1.js (renamed from jstests/json1.js)0
-rw-r--r--jstests/core/killop.js (renamed from jstests/killop.js)1
-rw-r--r--jstests/core/loadserverscripts.js (renamed from jstests/loadserverscripts.js)3
-rw-r--r--jstests/core/loglong.js (renamed from jstests/loglong.js)0
-rw-r--r--jstests/core/logprocessdetails.js (renamed from jstests/logprocessdetails.js)0
-rw-r--r--jstests/core/long_index_rename.js (renamed from jstests/long_index_rename.js)9
-rw-r--r--jstests/core/map1.js (renamed from jstests/map1.js)0
-rw-r--r--jstests/core/max_time_ms.js (renamed from jstests/max_time_ms.js)0
-rw-r--r--jstests/core/maxscan.js (renamed from jstests/maxscan.js)0
-rw-r--r--jstests/core/minmax.js (renamed from jstests/minmax.js)0
-rw-r--r--jstests/core/mod1.js (renamed from jstests/mod1.js)0
-rw-r--r--jstests/core/mr1.js (renamed from jstests/mr1.js)0
-rw-r--r--jstests/core/mr2.js (renamed from jstests/mr2.js)0
-rw-r--r--jstests/core/mr3.js (renamed from jstests/mr3.js)0
-rw-r--r--jstests/core/mr4.js (renamed from jstests/mr4.js)0
-rw-r--r--jstests/core/mr5.js (renamed from jstests/mr5.js)0
-rw-r--r--jstests/core/mr_bigobject.js (renamed from jstests/mr_bigobject.js)0
-rw-r--r--jstests/core/mr_comments.js (renamed from jstests/mr_comments.js)0
-rw-r--r--jstests/core/mr_drop.js (renamed from jstests/mr_drop.js)3
-rw-r--r--jstests/core/mr_errorhandling.js (renamed from jstests/mr_errorhandling.js)0
-rw-r--r--jstests/core/mr_index.js (renamed from jstests/mr_index.js)0
-rw-r--r--jstests/core/mr_index2.js (renamed from jstests/mr_index2.js)0
-rw-r--r--jstests/core/mr_index3.js (renamed from jstests/mr_index3.js)0
-rw-r--r--jstests/core/mr_killop.js (renamed from jstests/mr_killop.js)3
-rw-r--r--jstests/core/mr_merge.js (renamed from jstests/mr_merge.js)0
-rw-r--r--jstests/core/mr_merge2.js (renamed from jstests/mr_merge2.js)0
-rw-r--r--jstests/core/mr_mutable_properties.js (renamed from jstests/mr_mutable_properties.js)0
-rw-r--r--jstests/core/mr_optim.js (renamed from jstests/mr_optim.js)0
-rw-r--r--jstests/core/mr_outreduce.js (renamed from jstests/mr_outreduce.js)0
-rw-r--r--jstests/core/mr_outreduce2.js (renamed from jstests/mr_outreduce2.js)0
-rw-r--r--jstests/core/mr_replaceIntoDB.js (renamed from jstests/mr_replaceIntoDB.js)0
-rw-r--r--jstests/core/mr_sort.js (renamed from jstests/mr_sort.js)0
-rw-r--r--jstests/core/mr_stored.js (renamed from jstests/mr_stored.js)0
-rw-r--r--jstests/core/mr_undef.js (renamed from jstests/mr_undef.js)0
-rw-r--r--jstests/core/multi.js (renamed from jstests/multi.js)0
-rw-r--r--jstests/core/multi2.js (renamed from jstests/multi2.js)0
-rw-r--r--jstests/core/ne1.js (renamed from jstests/ne1.js)0
-rw-r--r--jstests/core/ne2.js (renamed from jstests/ne2.js)0
-rw-r--r--jstests/core/ne3.js (renamed from jstests/ne3.js)0
-rw-r--r--jstests/core/nestedarr1.js (renamed from jstests/nestedarr1.js)0
-rw-r--r--jstests/core/nestedobj1.js (renamed from jstests/nestedobj1.js)0
-rw-r--r--jstests/core/nin.js (renamed from jstests/nin.js)0
-rw-r--r--jstests/core/nin2.js (renamed from jstests/nin2.js)0
-rw-r--r--jstests/core/not1.js (renamed from jstests/not1.js)0
-rw-r--r--jstests/core/not2.js (renamed from jstests/not2.js)0
-rw-r--r--jstests/core/notablescan.js (renamed from jstests/notablescan.js)0
-rw-r--r--jstests/core/ns_length.js (renamed from jstests/ns_length.js)6
-rw-r--r--jstests/core/null.js (renamed from jstests/null.js)0
-rw-r--r--jstests/core/null2.js (renamed from jstests/null2.js)0
-rw-r--r--jstests/core/null_field_name.js (renamed from jstests/null_field_name.js)0
-rw-r--r--jstests/core/numberint.js (renamed from jstests/numberint.js)0
-rw-r--r--jstests/core/numberlong.js (renamed from jstests/numberlong.js)0
-rw-r--r--jstests/core/numberlong2.js (renamed from jstests/numberlong2.js)0
-rw-r--r--jstests/core/numberlong3.js (renamed from jstests/numberlong3.js)0
-rw-r--r--jstests/core/numberlong4.js (renamed from jstests/numberlong4.js)0
-rw-r--r--jstests/core/objid1.js (renamed from jstests/objid1.js)0
-rw-r--r--jstests/core/objid2.js (renamed from jstests/objid2.js)0
-rw-r--r--jstests/core/objid3.js (renamed from jstests/objid3.js)0
-rw-r--r--jstests/core/objid4.js (renamed from jstests/objid4.js)0
-rw-r--r--jstests/core/objid5.js (renamed from jstests/objid5.js)0
-rw-r--r--jstests/core/objid6.js (renamed from jstests/objid6.js)0
-rw-r--r--jstests/core/objid7.js (renamed from jstests/objid7.js)0
-rw-r--r--jstests/core/or1.js (renamed from jstests/or1.js)0
-rw-r--r--jstests/core/or2.js (renamed from jstests/or2.js)0
-rw-r--r--jstests/core/or3.js (renamed from jstests/or3.js)0
-rw-r--r--jstests/core/or4.js (renamed from jstests/or4.js)0
-rw-r--r--jstests/core/or5.js (renamed from jstests/or5.js)0
-rw-r--r--jstests/core/or6.js (renamed from jstests/or6.js)0
-rw-r--r--jstests/core/or7.js (renamed from jstests/or7.js)0
-rw-r--r--jstests/core/or8.js (renamed from jstests/or8.js)0
-rw-r--r--jstests/core/or9.js (renamed from jstests/or9.js)0
-rw-r--r--jstests/core/ora.js (renamed from jstests/ora.js)0
-rw-r--r--jstests/core/orb.js (renamed from jstests/orb.js)0
-rw-r--r--jstests/core/orc.js (renamed from jstests/orc.js)0
-rw-r--r--jstests/core/ord.js (renamed from jstests/ord.js)1
-rw-r--r--jstests/core/ore.js (renamed from jstests/ore.js)0
-rw-r--r--jstests/core/orf.js (renamed from jstests/orf.js)0
-rw-r--r--jstests/core/org.js (renamed from jstests/org.js)0
-rw-r--r--jstests/core/orh.js (renamed from jstests/orh.js)0
-rw-r--r--jstests/core/orj.js (renamed from jstests/orj.js)0
-rw-r--r--jstests/core/ork.js (renamed from jstests/ork.js)0
-rw-r--r--jstests/core/orl.js (renamed from jstests/orl.js)0
-rw-r--r--jstests/core/oro.js (renamed from jstests/oro.js)0
-rw-r--r--jstests/core/orp.js (renamed from jstests/orp.js)0
-rw-r--r--jstests/core/padding.js (renamed from jstests/padding.js)0
-rw-r--r--jstests/core/plan_cache_commands.js (renamed from jstests/plan_cache_commands.js)0
-rw-r--r--jstests/core/profile1.js (renamed from jstests/profile1.js)0
-rw-r--r--jstests/core/profile2.js (renamed from jstests/profile2.js)0
-rw-r--r--jstests/core/profile3.js (renamed from jstests/profile3.js)0
-rw-r--r--jstests/core/profile4.js (renamed from jstests/profile4.js)0
-rw-r--r--jstests/core/proj_key1.js (renamed from jstests/proj_key1.js)0
-rw-r--r--jstests/core/pull.js (renamed from jstests/pull.js)0
-rw-r--r--jstests/core/pull2.js (renamed from jstests/pull2.js)0
-rw-r--r--jstests/core/pull_or.js (renamed from jstests/pull_or.js)0
-rw-r--r--jstests/core/pull_remove1.js (renamed from jstests/pull_remove1.js)0
-rw-r--r--jstests/core/pullall.js (renamed from jstests/pullall.js)0
-rw-r--r--jstests/core/pullall2.js (renamed from jstests/pullall2.js)0
-rw-r--r--jstests/core/push.js (renamed from jstests/push.js)31
-rw-r--r--jstests/core/push2.js (renamed from jstests/push2.js)4
-rw-r--r--jstests/core/push_sort.js (renamed from jstests/push_sort.js)0
-rw-r--r--jstests/core/pushall.js (renamed from jstests/pushall.js)0
-rw-r--r--jstests/core/query1.js (renamed from jstests/query1.js)0
-rw-r--r--jstests/core/queryoptimizer3.js (renamed from jstests/queryoptimizer3.js)0
-rw-r--r--jstests/core/queryoptimizer6.js (renamed from jstests/queryoptimizer6.js)0
-rw-r--r--jstests/core/queryoptimizera.js (renamed from jstests/queryoptimizera.js)0
-rw-r--r--jstests/core/ref.js (renamed from jstests/ref.js)0
-rw-r--r--jstests/core/ref2.js (renamed from jstests/ref2.js)0
-rw-r--r--jstests/core/ref3.js (renamed from jstests/ref3.js)0
-rw-r--r--jstests/core/ref4.js (renamed from jstests/ref4.js)0
-rw-r--r--jstests/core/regex.js (renamed from jstests/regex.js)0
-rw-r--r--jstests/core/regex2.js (renamed from jstests/regex2.js)0
-rw-r--r--jstests/core/regex3.js (renamed from jstests/regex3.js)0
-rw-r--r--jstests/core/regex4.js (renamed from jstests/regex4.js)0
-rw-r--r--jstests/core/regex5.js (renamed from jstests/regex5.js)0
-rw-r--r--jstests/core/regex6.js (renamed from jstests/regex6.js)0
-rw-r--r--jstests/core/regex7.js (renamed from jstests/regex7.js)0
-rw-r--r--jstests/core/regex8.js (renamed from jstests/regex8.js)0
-rw-r--r--jstests/core/regex9.js (renamed from jstests/regex9.js)0
-rw-r--r--jstests/core/regex_embed1.js (renamed from jstests/regex_embed1.js)0
-rw-r--r--jstests/core/regex_limit.js (renamed from jstests/regex_limit.js)0
-rw-r--r--jstests/core/regex_options.js (renamed from jstests/regex_options.js)0
-rw-r--r--jstests/core/regex_util.js (renamed from jstests/regex_util.js)0
-rw-r--r--jstests/core/regexa.js (renamed from jstests/regexa.js)0
-rw-r--r--jstests/core/regexb.js (renamed from jstests/regexb.js)0
-rw-r--r--jstests/core/regexc.js (renamed from jstests/regexc.js)0
-rw-r--r--jstests/core/remove.js (renamed from jstests/remove.js)0
-rw-r--r--jstests/core/remove2.js (renamed from jstests/remove2.js)11
-rw-r--r--jstests/core/remove3.js (renamed from jstests/remove3.js)0
-rw-r--r--jstests/core/remove4.js (renamed from jstests/remove4.js)0
-rw-r--r--jstests/core/remove6.js (renamed from jstests/remove6.js)7
-rw-r--r--jstests/core/remove7.js (renamed from jstests/remove7.js)7
-rw-r--r--jstests/core/remove8.js (renamed from jstests/remove8.js)0
-rw-r--r--jstests/core/remove9.js (renamed from jstests/remove9.js)0
-rw-r--r--jstests/core/remove_justone.js (renamed from jstests/remove_justone.js)0
-rw-r--r--jstests/core/remove_undefined.js (renamed from jstests/remove_undefined.js)0
-rw-r--r--jstests/core/removea.js (renamed from jstests/removea.js)4
-rw-r--r--jstests/core/removeb.js (renamed from jstests/removeb.js)6
-rw-r--r--jstests/core/removec.js (renamed from jstests/removec.js)1
-rw-r--r--jstests/core/rename.js (renamed from jstests/rename.js)0
-rw-r--r--jstests/core/rename2.js (renamed from jstests/rename2.js)0
-rw-r--r--jstests/core/rename3.js (renamed from jstests/rename3.js)0
-rw-r--r--jstests/core/rename4.js (renamed from jstests/rename4.js)22
-rw-r--r--jstests/core/rename5.js (renamed from jstests/rename5.js)0
-rw-r--r--jstests/core/rename6.js (renamed from jstests/rename6.js)0
-rw-r--r--jstests/core/rename7.js (renamed from jstests/rename7.js)0
-rw-r--r--jstests/core/rename8.js (renamed from jstests/rename8.js)0
-rw-r--r--jstests/core/rename_stayTemp.js (renamed from jstests/rename_stayTemp.js)0
-rw-r--r--jstests/core/repair.js (renamed from jstests/repair.js)0
-rw-r--r--jstests/core/reversecursor.js (renamed from jstests/reversecursor.js)0
-rw-r--r--jstests/core/role_management_helpers.js (renamed from jstests/role_management_helpers.js)0
-rw-r--r--jstests/core/run_program1.js (renamed from jstests/run_program1.js)0
-rw-r--r--jstests/core/server1470.js (renamed from jstests/server1470.js)0
-rw-r--r--jstests/core/server5346.js (renamed from jstests/server5346.js)0
-rw-r--r--jstests/core/server7756.js (renamed from jstests/server7756.js)0
-rw-r--r--jstests/core/server9385.js (renamed from jstests/server9385.js)0
-rw-r--r--jstests/core/server9547.js (renamed from jstests/server9547.js)0
-rw-r--r--jstests/core/set1.js (renamed from jstests/set1.js)0
-rw-r--r--jstests/core/set2.js (renamed from jstests/set2.js)0
-rw-r--r--jstests/core/set3.js (renamed from jstests/set3.js)0
-rw-r--r--jstests/core/set4.js (renamed from jstests/set4.js)0
-rw-r--r--jstests/core/set5.js (renamed from jstests/set5.js)0
-rw-r--r--jstests/core/set6.js (renamed from jstests/set6.js)0
-rw-r--r--jstests/core/set7.js (renamed from jstests/set7.js)17
-rw-r--r--jstests/core/set_param1.js (renamed from jstests/set_param1.js)0
-rw-r--r--jstests/core/shell1.js (renamed from jstests/shell1.js)0
-rw-r--r--jstests/core/shell_writeconcern.js (renamed from jstests/shell_writeconcern.js)0
-rw-r--r--jstests/core/shellkillop.js (renamed from jstests/shellkillop.js)0
-rw-r--r--jstests/core/shellspawn.js (renamed from jstests/shellspawn.js)0
-rw-r--r--jstests/core/shellstartparallel.js (renamed from jstests/shellstartparallel.js)4
-rw-r--r--jstests/core/shelltypes.js (renamed from jstests/shelltypes.js)0
-rw-r--r--jstests/core/showdiskloc.js (renamed from jstests/showdiskloc.js)0
-rw-r--r--jstests/core/skip1.js (renamed from jstests/skip1.js)0
-rw-r--r--jstests/core/slice1.js (renamed from jstests/slice1.js)0
-rw-r--r--jstests/core/sort1.js (renamed from jstests/sort1.js)0
-rw-r--r--jstests/core/sort10.js (renamed from jstests/sort10.js)0
-rw-r--r--jstests/core/sort2.js (renamed from jstests/sort2.js)0
-rw-r--r--jstests/core/sort3.js (renamed from jstests/sort3.js)0
-rw-r--r--jstests/core/sort4.js (renamed from jstests/sort4.js)0
-rw-r--r--jstests/core/sort5.js (renamed from jstests/sort5.js)0
-rw-r--r--jstests/core/sort6.js (renamed from jstests/sort6.js)0
-rw-r--r--jstests/core/sort7.js (renamed from jstests/sort7.js)0
-rw-r--r--jstests/core/sort8.js (renamed from jstests/sort8.js)0
-rw-r--r--jstests/core/sort9.js (renamed from jstests/sort9.js)0
-rw-r--r--jstests/core/sort_numeric.js (renamed from jstests/sort_numeric.js)0
-rw-r--r--jstests/core/sorta.js (renamed from jstests/sorta.js)0
-rw-r--r--jstests/core/sortb.js (renamed from jstests/sortb.js)0
-rw-r--r--jstests/core/sortc.js (renamed from jstests/sortc.js)0
-rw-r--r--jstests/core/sortd.js (renamed from jstests/sortd.js)0
-rw-r--r--jstests/core/sortf.js (renamed from jstests/sortf.js)0
-rw-r--r--jstests/core/sortg.js (renamed from jstests/sortg.js)0
-rw-r--r--jstests/core/sorth.js (renamed from jstests/sorth.js)0
-rw-r--r--jstests/core/sorti.js (renamed from jstests/sorti.js)0
-rw-r--r--jstests/core/sortj.js (renamed from jstests/sortj.js)0
-rw-r--r--jstests/core/sortk.js (renamed from jstests/sortk.js)0
-rw-r--r--jstests/core/splitvector.js (renamed from jstests/splitvector.js)14
-rw-r--r--jstests/core/stages_and_hash.js (renamed from jstests/stages_and_hash.js)0
-rw-r--r--jstests/core/stages_and_sorted.js (renamed from jstests/stages_and_sorted.js)0
-rw-r--r--jstests/core/stages_collection_scan.js (renamed from jstests/stages_collection_scan.js)4
-rw-r--r--jstests/core/stages_fetch.js (renamed from jstests/stages_fetch.js)2
-rw-r--r--jstests/core/stages_ixscan.js (renamed from jstests/stages_ixscan.js)6
-rw-r--r--jstests/core/stages_limit_skip.js (renamed from jstests/stages_limit_skip.js)2
-rw-r--r--jstests/core/stages_mergesort.js (renamed from jstests/stages_mergesort.js)1
-rw-r--r--jstests/core/stages_or.js (renamed from jstests/stages_or.js)0
-rw-r--r--jstests/core/stages_sort.js (renamed from jstests/stages_sort.js)2
-rw-r--r--jstests/core/stages_text.js (renamed from jstests/stages_text.js)0
-rw-r--r--jstests/core/stats.js (renamed from jstests/stats.js)0
-rw-r--r--jstests/core/storageDetailsCommand.js (renamed from jstests/storageDetailsCommand.js)0
-rw-r--r--jstests/core/storefunc.js (renamed from jstests/storefunc.js)5
-rw-r--r--jstests/core/string_with_nul_bytes.js (renamed from jstests/string_with_nul_bytes.js)0
-rw-r--r--jstests/core/sub1.js (renamed from jstests/sub1.js)0
-rw-r--r--jstests/core/temp_cleanup.js (renamed from jstests/temp_cleanup.js)0
-rw-r--r--jstests/core/testminmax.js (renamed from jstests/testminmax.js)0
-rw-r--r--jstests/core/touch1.js (renamed from jstests/touch1.js)0
-rw-r--r--jstests/core/ts1.js (renamed from jstests/ts1.js)0
-rw-r--r--jstests/core/type1.js (renamed from jstests/type1.js)0
-rw-r--r--jstests/core/type2.js (renamed from jstests/type2.js)0
-rw-r--r--jstests/core/type3.js (renamed from jstests/type3.js)0
-rw-r--r--jstests/core/uniqueness.js (renamed from jstests/uniqueness.js)36
-rw-r--r--jstests/core/unset.js (renamed from jstests/unset.js)0
-rw-r--r--jstests/core/unset2.js (renamed from jstests/unset2.js)8
-rw-r--r--jstests/core/update.js (renamed from jstests/update.js)0
-rw-r--r--jstests/core/update2.js (renamed from jstests/update2.js)0
-rw-r--r--jstests/core/update3.js (renamed from jstests/update3.js)0
-rw-r--r--jstests/core/update5.js (renamed from jstests/update5.js)0
-rw-r--r--jstests/core/update6.js (renamed from jstests/update6.js)0
-rw-r--r--jstests/core/update7.js (renamed from jstests/update7.js)0
-rw-r--r--jstests/core/update8.js (renamed from jstests/update8.js)0
-rw-r--r--jstests/core/update9.js (renamed from jstests/update9.js)0
-rw-r--r--jstests/core/update_addToSet.js (renamed from jstests/update_addToSet.js)0
-rw-r--r--jstests/core/update_addToSet2.js (renamed from jstests/update_addToSet2.js)0
-rw-r--r--jstests/core/update_addToSet3.js (renamed from jstests/update_addToSet3.js)0
-rw-r--r--jstests/core/update_arraymatch1.js (renamed from jstests/update_arraymatch1.js)0
-rw-r--r--jstests/core/update_arraymatch2.js (renamed from jstests/update_arraymatch2.js)0
-rw-r--r--jstests/core/update_arraymatch3.js (renamed from jstests/update_arraymatch3.js)0
-rw-r--r--jstests/core/update_arraymatch4.js (renamed from jstests/update_arraymatch4.js)0
-rw-r--r--jstests/core/update_arraymatch5.js (renamed from jstests/update_arraymatch5.js)0
-rw-r--r--jstests/core/update_arraymatch6.js (renamed from jstests/update_arraymatch6.js)5
-rw-r--r--jstests/core/update_arraymatch7.js (renamed from jstests/update_arraymatch7.js)0
-rw-r--r--jstests/core/update_arraymatch8.js (renamed from jstests/update_arraymatch8.js)0
-rw-r--r--jstests/core/update_bit_examples.js (renamed from jstests/update_bit_examples.js)13
-rw-r--r--jstests/core/update_blank1.js (renamed from jstests/update_blank1.js)6
-rw-r--r--jstests/core/update_currentdate_examples.js (renamed from jstests/update_currentdate_examples.js)13
-rw-r--r--jstests/core/update_dbref.js40
-rw-r--r--jstests/core/update_invalid1.js (renamed from jstests/update_invalid1.js)0
-rw-r--r--jstests/core/update_min_max_examples.js (renamed from jstests/update_min_max_examples.js)17
-rw-r--r--jstests/core/update_mul_examples.js (renamed from jstests/update_mul_examples.js)13
-rw-r--r--jstests/core/update_multi3.js (renamed from jstests/update_multi3.js)0
-rw-r--r--jstests/core/update_multi4.js (renamed from jstests/update_multi4.js)0
-rw-r--r--jstests/core/update_multi5.js (renamed from jstests/update_multi5.js)0
-rw-r--r--jstests/core/update_multi6.js (renamed from jstests/update_multi6.js)5
-rw-r--r--jstests/core/update_replace.js (renamed from jstests/update_replace.js)38
-rw-r--r--jstests/core/update_setOnInsert.js (renamed from jstests/update_setOnInsert.js)16
-rw-r--r--jstests/core/updatea.js (renamed from jstests/updatea.js)43
-rw-r--r--jstests/core/updateb.js (renamed from jstests/updateb.js)0
-rw-r--r--jstests/core/updatec.js (renamed from jstests/updatec.js)0
-rw-r--r--jstests/core/updated.js (renamed from jstests/updated.js)0
-rw-r--r--jstests/core/updatee.js (renamed from jstests/updatee.js)0
-rw-r--r--jstests/core/updatef.js (renamed from jstests/updatef.js)1
-rw-r--r--jstests/core/updateg.js (renamed from jstests/updateg.js)0
-rw-r--r--jstests/core/updateh.js33
-rw-r--r--jstests/core/updatei.js (renamed from jstests/updatei.js)0
-rw-r--r--jstests/core/updatej.js (renamed from jstests/updatej.js)0
-rw-r--r--jstests/core/updatek.js (renamed from jstests/updatek.js)0
-rw-r--r--jstests/core/updatel.js (renamed from jstests/updatel.js)17
-rw-r--r--jstests/core/updatem.js (renamed from jstests/updatem.js)0
-rw-r--r--jstests/core/upsert1.js52
-rw-r--r--jstests/core/upsert2.js (renamed from jstests/upsert2.js)0
-rw-r--r--jstests/core/upsert3.js52
-rw-r--r--jstests/core/upsert4.js37
-rw-r--r--jstests/core/use_power_of_2.js52
-rwxr-xr-xjstests/core/useindexonobjgtlt.js (renamed from jstests/useindexonobjgtlt.js)0
-rw-r--r--jstests/core/user_management_helpers.js (renamed from jstests/user_management_helpers.js)0
-rw-r--r--jstests/core/validate_cmd_ns.js (renamed from jstests/validate_cmd_ns.js)0
-rw-r--r--jstests/core/validate_user_documents.js (renamed from jstests/validate_user_documents.js)0
-rw-r--r--jstests/core/verify_update_mods.js83
-rw-r--r--jstests/core/where1.js (renamed from jstests/where1.js)0
-rw-r--r--jstests/core/where2.js (renamed from jstests/where2.js)0
-rw-r--r--jstests/core/where3.js (renamed from jstests/where3.js)0
-rw-r--r--jstests/core/where4.js (renamed from jstests/where4.js)0
-rw-r--r--jstests/orm.js29
-rw-r--r--jstests/orn.js22
-rw-r--r--jstests/queryoptimizer1.js27
-rw-r--r--jstests/queryoptimizer5.js27
-rw-r--r--jstests/slowNightly/opcounters_legacy.js2
-rw-r--r--jstests/slowNightly/opcounters_write_cmd.js (renamed from jstests/core/opcounters.js)83
-rw-r--r--jstests/update_dbref.js36
-rw-r--r--jstests/updateh.js39
-rw-r--r--jstests/upsert1.js59
-rw-r--r--jstests/upsert3.js60
-rw-r--r--jstests/upsert4.js36
-rw-r--r--jstests/use_power_of_2.js86
-rw-r--r--jstests/verify_update_mods.js82
300 files changed, 578 insertions, 766 deletions
diff --git a/jstests/js1.js b/jstests/core/js1.js
index 240d9f82fbb..240d9f82fbb 100644
--- a/jstests/js1.js
+++ b/jstests/core/js1.js
diff --git a/jstests/js2.js b/jstests/core/js2.js
index 8753599887a..8753599887a 100644
--- a/jstests/js2.js
+++ b/jstests/core/js2.js
diff --git a/jstests/js3.js b/jstests/core/js3.js
index 4249ad6183d..4249ad6183d 100644
--- a/jstests/js3.js
+++ b/jstests/core/js3.js
diff --git a/jstests/js4.js b/jstests/core/js4.js
index 38cadf355de..38cadf355de 100644
--- a/jstests/js4.js
+++ b/jstests/core/js4.js
diff --git a/jstests/js5.js b/jstests/core/js5.js
index 84770d72da2..84770d72da2 100644
--- a/jstests/js5.js
+++ b/jstests/core/js5.js
diff --git a/jstests/js7.js b/jstests/core/js7.js
index d12e207379e..d12e207379e 100644
--- a/jstests/js7.js
+++ b/jstests/core/js7.js
diff --git a/jstests/js8.js b/jstests/core/js8.js
index da2dcc619cd..da2dcc619cd 100644
--- a/jstests/js8.js
+++ b/jstests/core/js8.js
diff --git a/jstests/js9.js b/jstests/core/js9.js
index 8748667f527..8748667f527 100644
--- a/jstests/js9.js
+++ b/jstests/core/js9.js
diff --git a/jstests/json1.js b/jstests/core/json1.js
index 054a9b46047..054a9b46047 100644
--- a/jstests/json1.js
+++ b/jstests/core/json1.js
diff --git a/jstests/killop.js b/jstests/core/killop.js
index 9567391598d..73897bd25dd 100644
--- a/jstests/killop.js
+++ b/jstests/core/killop.js
@@ -15,7 +15,6 @@ t = db.jstests_killop
t.drop();
t.save( {} );
-db.getLastError();
/**
* This function filters for the operations that we're looking for, based on their state and
diff --git a/jstests/loadserverscripts.js b/jstests/core/loadserverscripts.js
index 792e1c9228a..4581dda21cc 100644
--- a/jstests/loadserverscripts.js
+++ b/jstests/core/loadserverscripts.js
@@ -36,8 +36,7 @@ assert.eq(x, "myfunc", "Checking that myfunc() returns the correct value");
// Insert value into collection from another process
var coproc = startParallelShell(
'db.getSisterDB("loadserverscripts").system.js.insert' +
- ' ( {_id: "myfunc2", "value": function(){ return "myfunc2"; } } );' +
- 'db.getLastError();'
+ ' ( {_id: "myfunc2", "value": function(){ return "myfunc2"; } } );'
);
// wait for results
coproc();
diff --git a/jstests/loglong.js b/jstests/core/loglong.js
index 06cbf296c09..06cbf296c09 100644
--- a/jstests/loglong.js
+++ b/jstests/core/loglong.js
diff --git a/jstests/logprocessdetails.js b/jstests/core/logprocessdetails.js
index 607b1acb057..607b1acb057 100644
--- a/jstests/logprocessdetails.js
+++ b/jstests/core/logprocessdetails.js
diff --git a/jstests/long_index_rename.js b/jstests/core/long_index_rename.js
index 41e1bfd4a3b..718d0bd09aa 100644
--- a/jstests/long_index_rename.js
+++ b/jstests/core/long_index_rename.js
@@ -11,8 +11,7 @@ for (i = 1; i < 10; i++) {
}
t.createIndex({a:1}, {name: "aaa"});
-t.createIndex({a:1}, {name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"});
-var result = db.getLastErrorObj();
-assert( result.code >= 0 );
-assert( result.err.indexOf( "too long" ) >= 0 );
+var result = t.createIndex({a:1}, {name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"});
+assert( !result.ok );
+assert( result.getWriteError().errmsg.indexOf( "too long" ) >= 0 );
diff --git a/jstests/map1.js b/jstests/core/map1.js
index 1db53cd3848..1db53cd3848 100644
--- a/jstests/map1.js
+++ b/jstests/core/map1.js
diff --git a/jstests/max_time_ms.js b/jstests/core/max_time_ms.js
index 1d0cca7949f..1d0cca7949f 100644
--- a/jstests/max_time_ms.js
+++ b/jstests/core/max_time_ms.js
diff --git a/jstests/maxscan.js b/jstests/core/maxscan.js
index 3d15b26f638..3d15b26f638 100644
--- a/jstests/maxscan.js
+++ b/jstests/core/maxscan.js
diff --git a/jstests/minmax.js b/jstests/core/minmax.js
index d84a6e42855..d84a6e42855 100644
--- a/jstests/minmax.js
+++ b/jstests/core/minmax.js
diff --git a/jstests/mod1.js b/jstests/core/mod1.js
index 46e3482bc72..46e3482bc72 100644
--- a/jstests/mod1.js
+++ b/jstests/core/mod1.js
diff --git a/jstests/mr1.js b/jstests/core/mr1.js
index 33390a6187a..33390a6187a 100644
--- a/jstests/mr1.js
+++ b/jstests/core/mr1.js
diff --git a/jstests/mr2.js b/jstests/core/mr2.js
index c15d8abdfae..c15d8abdfae 100644
--- a/jstests/mr2.js
+++ b/jstests/core/mr2.js
diff --git a/jstests/mr3.js b/jstests/core/mr3.js
index 3b0a918a4f3..3b0a918a4f3 100644
--- a/jstests/mr3.js
+++ b/jstests/core/mr3.js
diff --git a/jstests/mr4.js b/jstests/core/mr4.js
index 78c8bce8953..78c8bce8953 100644
--- a/jstests/mr4.js
+++ b/jstests/core/mr4.js
diff --git a/jstests/mr5.js b/jstests/core/mr5.js
index 50a63d1d55b..50a63d1d55b 100644
--- a/jstests/mr5.js
+++ b/jstests/core/mr5.js
diff --git a/jstests/mr_bigobject.js b/jstests/core/mr_bigobject.js
index 97195e2542e..97195e2542e 100644
--- a/jstests/mr_bigobject.js
+++ b/jstests/core/mr_bigobject.js
diff --git a/jstests/mr_comments.js b/jstests/core/mr_comments.js
index f6a06994f55..f6a06994f55 100644
--- a/jstests/mr_comments.js
+++ b/jstests/core/mr_comments.js
diff --git a/jstests/mr_drop.js b/jstests/core/mr_drop.js
index 8c4f9f8846f..4bd141df518 100644
--- a/jstests/mr_drop.js
+++ b/jstests/core/mr_drop.js
@@ -18,7 +18,6 @@ for( i = 0; i < 10000; ++i ) {
reduceSleep:reduceSleep,
finalizeSleep:finalizeSleep } );
}
-db.getLastError();
// Schedule a collection drop two seconds in the future.
s = startParallelShell( "sleep( 2000 ); db.jstests_mr_drop.drop();" );
@@ -35,4 +34,4 @@ t.mapReduce( function() { sleep( this.mapSleep ); emit( this.key, this ); },
s();
// Ensure the server is still alive. Under SERVER-6757 the server can crash.
-assert( !db.getLastError() );
+assert( db.serverStatus().ok );
diff --git a/jstests/mr_errorhandling.js b/jstests/core/mr_errorhandling.js
index c4e1137b4c6..c4e1137b4c6 100644
--- a/jstests/mr_errorhandling.js
+++ b/jstests/core/mr_errorhandling.js
diff --git a/jstests/mr_index.js b/jstests/core/mr_index.js
index 521d44d29f0..521d44d29f0 100644
--- a/jstests/mr_index.js
+++ b/jstests/core/mr_index.js
diff --git a/jstests/mr_index2.js b/jstests/core/mr_index2.js
index a8d845ed69d..a8d845ed69d 100644
--- a/jstests/mr_index2.js
+++ b/jstests/core/mr_index2.js
diff --git a/jstests/mr_index3.js b/jstests/core/mr_index3.js
index 0607cc8aa84..0607cc8aa84 100644
--- a/jstests/mr_index3.js
+++ b/jstests/core/mr_index3.js
diff --git a/jstests/mr_killop.js b/jstests/core/mr_killop.js
index fe2a9ac76fa..5ef3f5eeb37 100644
--- a/jstests/mr_killop.js
+++ b/jstests/core/mr_killop.js
@@ -52,8 +52,7 @@ function testOne( map, reduce, finalize, scope, childLoop, wait ) {
// Ensure we have 2 documents for the reduce to run
t.save( {a:1} );
t.save( {a:1} );
- db.getLastError();
-
+
spec = {
mapreduce:"jstests_mr_killop",
out:"jstests_mr_killop_out",
diff --git a/jstests/mr_merge.js b/jstests/core/mr_merge.js
index 9350c45f773..9350c45f773 100644
--- a/jstests/mr_merge.js
+++ b/jstests/core/mr_merge.js
diff --git a/jstests/mr_merge2.js b/jstests/core/mr_merge2.js
index 520bbfdbc8e..520bbfdbc8e 100644
--- a/jstests/mr_merge2.js
+++ b/jstests/core/mr_merge2.js
diff --git a/jstests/mr_mutable_properties.js b/jstests/core/mr_mutable_properties.js
index 7c4442aab9e..7c4442aab9e 100644
--- a/jstests/mr_mutable_properties.js
+++ b/jstests/core/mr_mutable_properties.js
diff --git a/jstests/mr_optim.js b/jstests/core/mr_optim.js
index 164839e2f2c..164839e2f2c 100644
--- a/jstests/mr_optim.js
+++ b/jstests/core/mr_optim.js
diff --git a/jstests/mr_outreduce.js b/jstests/core/mr_outreduce.js
index 793ec252feb..793ec252feb 100644
--- a/jstests/mr_outreduce.js
+++ b/jstests/core/mr_outreduce.js
diff --git a/jstests/mr_outreduce2.js b/jstests/core/mr_outreduce2.js
index fc273638577..fc273638577 100644
--- a/jstests/mr_outreduce2.js
+++ b/jstests/core/mr_outreduce2.js
diff --git a/jstests/mr_replaceIntoDB.js b/jstests/core/mr_replaceIntoDB.js
index 217f40717e5..217f40717e5 100644
--- a/jstests/mr_replaceIntoDB.js
+++ b/jstests/core/mr_replaceIntoDB.js
diff --git a/jstests/mr_sort.js b/jstests/core/mr_sort.js
index cc8db18e174..cc8db18e174 100644
--- a/jstests/mr_sort.js
+++ b/jstests/core/mr_sort.js
diff --git a/jstests/mr_stored.js b/jstests/core/mr_stored.js
index 7963d9892e1..7963d9892e1 100644
--- a/jstests/mr_stored.js
+++ b/jstests/core/mr_stored.js
diff --git a/jstests/mr_undef.js b/jstests/core/mr_undef.js
index e162f99836b..e162f99836b 100644
--- a/jstests/mr_undef.js
+++ b/jstests/core/mr_undef.js
diff --git a/jstests/multi.js b/jstests/core/multi.js
index eb6cad348cd..eb6cad348cd 100644
--- a/jstests/multi.js
+++ b/jstests/core/multi.js
diff --git a/jstests/multi2.js b/jstests/core/multi2.js
index 7c72722fd34..7c72722fd34 100644
--- a/jstests/multi2.js
+++ b/jstests/core/multi2.js
diff --git a/jstests/ne1.js b/jstests/core/ne1.js
index e1c5656b5c8..e1c5656b5c8 100644
--- a/jstests/ne1.js
+++ b/jstests/core/ne1.js
diff --git a/jstests/ne2.js b/jstests/core/ne2.js
index a69bfd6a114..a69bfd6a114 100644
--- a/jstests/ne2.js
+++ b/jstests/core/ne2.js
diff --git a/jstests/ne3.js b/jstests/core/ne3.js
index 3260fd3c40f..3260fd3c40f 100644
--- a/jstests/ne3.js
+++ b/jstests/core/ne3.js
diff --git a/jstests/nestedarr1.js b/jstests/core/nestedarr1.js
index b3bc9b73156..b3bc9b73156 100644
--- a/jstests/nestedarr1.js
+++ b/jstests/core/nestedarr1.js
diff --git a/jstests/nestedobj1.js b/jstests/core/nestedobj1.js
index 45ef0c530d4..45ef0c530d4 100644
--- a/jstests/nestedobj1.js
+++ b/jstests/core/nestedobj1.js
diff --git a/jstests/nin.js b/jstests/core/nin.js
index 06582781591..06582781591 100644
--- a/jstests/nin.js
+++ b/jstests/core/nin.js
diff --git a/jstests/nin2.js b/jstests/core/nin2.js
index afdbb0494da..afdbb0494da 100644
--- a/jstests/nin2.js
+++ b/jstests/core/nin2.js
diff --git a/jstests/not1.js b/jstests/core/not1.js
index f99a8490170..f99a8490170 100644
--- a/jstests/not1.js
+++ b/jstests/core/not1.js
diff --git a/jstests/not2.js b/jstests/core/not2.js
index 239ea89d226..239ea89d226 100644
--- a/jstests/not2.js
+++ b/jstests/core/not2.js
diff --git a/jstests/notablescan.js b/jstests/core/notablescan.js
index f2ca68d2912..f2ca68d2912 100644
--- a/jstests/notablescan.js
+++ b/jstests/core/notablescan.js
diff --git a/jstests/ns_length.js b/jstests/core/ns_length.js
index 2e3fb02b0af..c04b35904dc 100644
--- a/jstests/ns_length.js
+++ b/jstests/core/ns_length.js
@@ -18,8 +18,8 @@ function mkStr(length) {
function canMakeCollectionWithName(name) {
assert.eq(myDb.stats().fileSize, 0, "initial conditions");
- myDb[name].insert({});
- var success = myDb.getLastError() == null;
+ var res = myDb[name].insert({});
+ var success = !res.hasWriteErrors();
if (!success) {
assert.eq(myDb.stats().fileSize, 0, "no files should be created on error");
return false;
@@ -30,7 +30,7 @@ function canMakeCollectionWithName(name) {
}
function canMakeIndexWithName(collection, name) {
- var success = (collection.ensureIndex({x:1}, {name: name}) == undefined);
+ var success = !(collection.ensureIndex({x:1}, {name: name}).hasWriteErrors());
if (success) {
assert.commandWorked(collection.dropIndex(name));
}
diff --git a/jstests/null.js b/jstests/core/null.js
index f4bdeb44a4d..f4bdeb44a4d 100644
--- a/jstests/null.js
+++ b/jstests/core/null.js
diff --git a/jstests/null2.js b/jstests/core/null2.js
index 17b1a392714..17b1a392714 100644
--- a/jstests/null2.js
+++ b/jstests/core/null2.js
diff --git a/jstests/null_field_name.js b/jstests/core/null_field_name.js
index 7fa14b0a1bc..7fa14b0a1bc 100644
--- a/jstests/null_field_name.js
+++ b/jstests/core/null_field_name.js
diff --git a/jstests/numberint.js b/jstests/core/numberint.js
index 258450f8e82..258450f8e82 100644
--- a/jstests/numberint.js
+++ b/jstests/core/numberint.js
diff --git a/jstests/numberlong.js b/jstests/core/numberlong.js
index 1cbbc7a798a..1cbbc7a798a 100644
--- a/jstests/numberlong.js
+++ b/jstests/core/numberlong.js
diff --git a/jstests/numberlong2.js b/jstests/core/numberlong2.js
index 5d7529a9e21..5d7529a9e21 100644
--- a/jstests/numberlong2.js
+++ b/jstests/core/numberlong2.js
diff --git a/jstests/numberlong3.js b/jstests/core/numberlong3.js
index 10036c0544e..10036c0544e 100644
--- a/jstests/numberlong3.js
+++ b/jstests/core/numberlong3.js
diff --git a/jstests/numberlong4.js b/jstests/core/numberlong4.js
index 0924931efaf..0924931efaf 100644
--- a/jstests/numberlong4.js
+++ b/jstests/core/numberlong4.js
diff --git a/jstests/objid1.js b/jstests/core/objid1.js
index dea31eed0d8..dea31eed0d8 100644
--- a/jstests/objid1.js
+++ b/jstests/core/objid1.js
diff --git a/jstests/objid2.js b/jstests/core/objid2.js
index a28c18fca15..a28c18fca15 100644
--- a/jstests/objid2.js
+++ b/jstests/core/objid2.js
diff --git a/jstests/objid3.js b/jstests/core/objid3.js
index ddf20d9af27..ddf20d9af27 100644
--- a/jstests/objid3.js
+++ b/jstests/core/objid3.js
diff --git a/jstests/objid4.js b/jstests/core/objid4.js
index 23986b95c71..23986b95c71 100644
--- a/jstests/objid4.js
+++ b/jstests/core/objid4.js
diff --git a/jstests/objid5.js b/jstests/core/objid5.js
index f85ebc8c71d..f85ebc8c71d 100644
--- a/jstests/objid5.js
+++ b/jstests/core/objid5.js
diff --git a/jstests/objid6.js b/jstests/core/objid6.js
index b90dc9e914e..b90dc9e914e 100644
--- a/jstests/objid6.js
+++ b/jstests/core/objid6.js
diff --git a/jstests/objid7.js b/jstests/core/objid7.js
index 5a5ca728c7d..5a5ca728c7d 100644
--- a/jstests/objid7.js
+++ b/jstests/core/objid7.js
diff --git a/jstests/or1.js b/jstests/core/or1.js
index 66bbd2e6eea..66bbd2e6eea 100644
--- a/jstests/or1.js
+++ b/jstests/core/or1.js
diff --git a/jstests/or2.js b/jstests/core/or2.js
index 00e9f68decf..00e9f68decf 100644
--- a/jstests/or2.js
+++ b/jstests/core/or2.js
diff --git a/jstests/or3.js b/jstests/core/or3.js
index 7759e689f84..7759e689f84 100644
--- a/jstests/or3.js
+++ b/jstests/core/or3.js
diff --git a/jstests/or4.js b/jstests/core/or4.js
index 23c10bba8e2..23c10bba8e2 100644
--- a/jstests/or4.js
+++ b/jstests/core/or4.js
diff --git a/jstests/or5.js b/jstests/core/or5.js
index 6a7316787d4..6a7316787d4 100644
--- a/jstests/or5.js
+++ b/jstests/core/or5.js
diff --git a/jstests/or6.js b/jstests/core/or6.js
index 43b75f467aa..43b75f467aa 100644
--- a/jstests/or6.js
+++ b/jstests/core/or6.js
diff --git a/jstests/or7.js b/jstests/core/or7.js
index 916158047d8..916158047d8 100644
--- a/jstests/or7.js
+++ b/jstests/core/or7.js
diff --git a/jstests/or8.js b/jstests/core/or8.js
index 40d5b38cede..40d5b38cede 100644
--- a/jstests/or8.js
+++ b/jstests/core/or8.js
diff --git a/jstests/or9.js b/jstests/core/or9.js
index 7318a532af4..7318a532af4 100644
--- a/jstests/or9.js
+++ b/jstests/core/or9.js
diff --git a/jstests/ora.js b/jstests/core/ora.js
index 67af4c191ec..67af4c191ec 100644
--- a/jstests/ora.js
+++ b/jstests/core/ora.js
diff --git a/jstests/orb.js b/jstests/core/orb.js
index a4abdeecabf..a4abdeecabf 100644
--- a/jstests/orb.js
+++ b/jstests/core/orb.js
diff --git a/jstests/orc.js b/jstests/core/orc.js
index dec6a7b920d..dec6a7b920d 100644
--- a/jstests/orc.js
+++ b/jstests/core/orc.js
diff --git a/jstests/ord.js b/jstests/core/ord.js
index 1ab0c1258a9..df47c405146 100644
--- a/jstests/ord.js
+++ b/jstests/core/ord.js
@@ -28,7 +28,6 @@ for( i = 0; i < 90; ++i ) {
// the index key {a:1}.
t.dropIndex( {a:1} );
-db.getLastError();
// Dropping an index kills all cursors on the indexed namespace, not just those
// cursors using the dropped index.
diff --git a/jstests/ore.js b/jstests/core/ore.js
index f938f635d41..f938f635d41 100644
--- a/jstests/ore.js
+++ b/jstests/core/ore.js
diff --git a/jstests/orf.js b/jstests/core/orf.js
index 720b5b31f0c..720b5b31f0c 100644
--- a/jstests/orf.js
+++ b/jstests/core/orf.js
diff --git a/jstests/org.js b/jstests/core/org.js
index 19239f96c10..19239f96c10 100644
--- a/jstests/org.js
+++ b/jstests/core/org.js
diff --git a/jstests/orh.js b/jstests/core/orh.js
index 5fb845fd01c..5fb845fd01c 100644
--- a/jstests/orh.js
+++ b/jstests/core/orh.js
diff --git a/jstests/orj.js b/jstests/core/orj.js
index fa234f36cb5..fa234f36cb5 100644
--- a/jstests/orj.js
+++ b/jstests/core/orj.js
diff --git a/jstests/ork.js b/jstests/core/ork.js
index d6d40161e69..d6d40161e69 100644
--- a/jstests/ork.js
+++ b/jstests/core/ork.js
diff --git a/jstests/orl.js b/jstests/core/orl.js
index 2726975d5aa..2726975d5aa 100644
--- a/jstests/orl.js
+++ b/jstests/core/orl.js
diff --git a/jstests/oro.js b/jstests/core/oro.js
index ae1b6f53552..ae1b6f53552 100644
--- a/jstests/oro.js
+++ b/jstests/core/oro.js
diff --git a/jstests/orp.js b/jstests/core/orp.js
index 18abdfbc63a..18abdfbc63a 100644
--- a/jstests/orp.js
+++ b/jstests/core/orp.js
diff --git a/jstests/padding.js b/jstests/core/padding.js
index 1872574d80f..1872574d80f 100644
--- a/jstests/padding.js
+++ b/jstests/core/padding.js
diff --git a/jstests/plan_cache_commands.js b/jstests/core/plan_cache_commands.js
index 9554e3017b2..9554e3017b2 100644
--- a/jstests/plan_cache_commands.js
+++ b/jstests/core/plan_cache_commands.js
diff --git a/jstests/profile1.js b/jstests/core/profile1.js
index 7c168dea0ab..7c168dea0ab 100644
--- a/jstests/profile1.js
+++ b/jstests/core/profile1.js
diff --git a/jstests/profile2.js b/jstests/core/profile2.js
index 1006c03a40d..1006c03a40d 100644
--- a/jstests/profile2.js
+++ b/jstests/core/profile2.js
diff --git a/jstests/profile3.js b/jstests/core/profile3.js
index 89fa0a33269..89fa0a33269 100644
--- a/jstests/profile3.js
+++ b/jstests/core/profile3.js
diff --git a/jstests/profile4.js b/jstests/core/profile4.js
index 5b9a0a66be2..5b9a0a66be2 100644
--- a/jstests/profile4.js
+++ b/jstests/core/profile4.js
diff --git a/jstests/proj_key1.js b/jstests/core/proj_key1.js
index ad944f71827..ad944f71827 100644
--- a/jstests/proj_key1.js
+++ b/jstests/core/proj_key1.js
diff --git a/jstests/pull.js b/jstests/core/pull.js
index 3cb6328e2de..3cb6328e2de 100644
--- a/jstests/pull.js
+++ b/jstests/core/pull.js
diff --git a/jstests/pull2.js b/jstests/core/pull2.js
index ca13fc2e726..ca13fc2e726 100644
--- a/jstests/pull2.js
+++ b/jstests/core/pull2.js
diff --git a/jstests/pull_or.js b/jstests/core/pull_or.js
index 905c7a87060..905c7a87060 100644
--- a/jstests/pull_or.js
+++ b/jstests/core/pull_or.js
diff --git a/jstests/pull_remove1.js b/jstests/core/pull_remove1.js
index 379f3f2832b..379f3f2832b 100644
--- a/jstests/pull_remove1.js
+++ b/jstests/core/pull_remove1.js
diff --git a/jstests/pullall.js b/jstests/core/pullall.js
index 7dd932c4bbf..7dd932c4bbf 100644
--- a/jstests/pullall.js
+++ b/jstests/core/pullall.js
diff --git a/jstests/pullall2.js b/jstests/core/pullall2.js
index 61369badaa4..61369badaa4 100644
--- a/jstests/pullall2.js
+++ b/jstests/core/pullall2.js
diff --git a/jstests/push.js b/jstests/core/push.js
index 9bcaa2ffb6b..7e801c7a2af 100644
--- a/jstests/push.js
+++ b/jstests/core/push.js
@@ -1,5 +1,6 @@
+var res;
-t = db.push
+t = db.push;
t.drop();
t.save( { _id : 2 , a : [ 1 ] } );
@@ -25,30 +26,30 @@ assert.eq( "3,4,5" , t.findOne().a.toString() , "E2" );
t.update( { _id : 2 } , { $pop : { a : -1 } } );
assert.eq( "4,5" , t.findOne().a.toString() , "E3" );
-t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.isnull( db.getLastError() , "E4a" )
+res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
+assert.writeOK( res )
assert.eq( "5" , t.findOne().a.toString() , "E4" );
-t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.isnull( db.getLastError() , "E5a")
+res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
+assert.writeOK( res )
assert.eq( "" , t.findOne().a.toString() , "E5" );
-t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.isnull( db.getLastError() , "E6a" )
+res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
+assert.writeOK( res )
assert.eq( "" , t.findOne().a.toString() , "E6" );
-t.update( { _id : 2 } , { $pop : { a : -1 } } );
-assert.isnull( db.getLastError() , "E7a" )
+res = t.update( { _id : 2 } , { $pop : { a : -1 } } );
+assert.writeOK( res )
assert.eq( "" , t.findOne().a.toString() , "E7" );
-t.update( { _id : 2 } , { $pop : { a : 1 } } );
-assert.isnull( db.getLastError() , "E8a" )
+res = t.update( { _id : 2 } , { $pop : { a : 1 } } );
+assert.writeOK( res )
assert.eq( "" , t.findOne().a.toString() , "E8" );
-t.update( { _id : 2 } , { $pop : { b : -1 } } );
-assert.isnull( db.getLastError() , "E4a" )
+res = t.update( { _id : 2 } , { $pop : { b : -1 } } );
+assert.writeOK( res )
-t.update( { _id : 2 } , { $pop : { b : 1 } } );
-assert.isnull( db.getLastError() , "E4a" )
+res = t.update( { _id : 2 } , { $pop : { b : 1 } } );
+assert.writeOK( res )
diff --git a/jstests/push2.js b/jstests/core/push2.js
index e8bcff6760c..ae09b20fb30 100644
--- a/jstests/push2.js
+++ b/jstests/core/push2.js
@@ -10,8 +10,8 @@ gotError = null;
for ( x=0; x<100; x++ ){
print (x + " pushes");
- t.update( {} , { $push : { a : s } } );
- gotError = db.getLastError();
+ var res = t.update( {} , { $push : { a : s } } );
+ gotError = res.hasWriteErrors();
if ( gotError )
break;
}
diff --git a/jstests/push_sort.js b/jstests/core/push_sort.js
index 87916d5ea6b..87916d5ea6b 100644
--- a/jstests/push_sort.js
+++ b/jstests/core/push_sort.js
diff --git a/jstests/pushall.js b/jstests/core/pushall.js
index eda68203ed3..eda68203ed3 100644
--- a/jstests/pushall.js
+++ b/jstests/core/pushall.js
diff --git a/jstests/query1.js b/jstests/core/query1.js
index 8fa402cda65..8fa402cda65 100644
--- a/jstests/query1.js
+++ b/jstests/core/query1.js
diff --git a/jstests/queryoptimizer3.js b/jstests/core/queryoptimizer3.js
index a90c7985839..a90c7985839 100644
--- a/jstests/queryoptimizer3.js
+++ b/jstests/core/queryoptimizer3.js
diff --git a/jstests/queryoptimizer6.js b/jstests/core/queryoptimizer6.js
index 32efccbdb0b..32efccbdb0b 100644
--- a/jstests/queryoptimizer6.js
+++ b/jstests/core/queryoptimizer6.js
diff --git a/jstests/queryoptimizera.js b/jstests/core/queryoptimizera.js
index f26c2b0978c..f26c2b0978c 100644
--- a/jstests/queryoptimizera.js
+++ b/jstests/core/queryoptimizera.js
diff --git a/jstests/ref.js b/jstests/core/ref.js
index 20fd6ca94f0..20fd6ca94f0 100644
--- a/jstests/ref.js
+++ b/jstests/core/ref.js
diff --git a/jstests/ref2.js b/jstests/core/ref2.js
index 29640cd5da0..29640cd5da0 100644
--- a/jstests/ref2.js
+++ b/jstests/core/ref2.js
diff --git a/jstests/ref3.js b/jstests/core/ref3.js
index 14037ee4cc8..14037ee4cc8 100644
--- a/jstests/ref3.js
+++ b/jstests/core/ref3.js
diff --git a/jstests/ref4.js b/jstests/core/ref4.js
index 1c105ef2795..1c105ef2795 100644
--- a/jstests/ref4.js
+++ b/jstests/core/ref4.js
diff --git a/jstests/regex.js b/jstests/core/regex.js
index f431d506ea6..f431d506ea6 100644
--- a/jstests/regex.js
+++ b/jstests/core/regex.js
diff --git a/jstests/regex2.js b/jstests/core/regex2.js
index 87d5cb47c05..87d5cb47c05 100644
--- a/jstests/regex2.js
+++ b/jstests/core/regex2.js
diff --git a/jstests/regex3.js b/jstests/core/regex3.js
index 5ac8fab4c40..5ac8fab4c40 100644
--- a/jstests/regex3.js
+++ b/jstests/core/regex3.js
diff --git a/jstests/regex4.js b/jstests/core/regex4.js
index fc26d691c91..fc26d691c91 100644
--- a/jstests/regex4.js
+++ b/jstests/core/regex4.js
diff --git a/jstests/regex5.js b/jstests/core/regex5.js
index 9f2549d7146..9f2549d7146 100644
--- a/jstests/regex5.js
+++ b/jstests/core/regex5.js
diff --git a/jstests/regex6.js b/jstests/core/regex6.js
index 54143248398..54143248398 100644
--- a/jstests/regex6.js
+++ b/jstests/core/regex6.js
diff --git a/jstests/regex7.js b/jstests/core/regex7.js
index ab4f6089f9b..ab4f6089f9b 100644
--- a/jstests/regex7.js
+++ b/jstests/core/regex7.js
diff --git a/jstests/regex8.js b/jstests/core/regex8.js
index 33dd74fb812..33dd74fb812 100644
--- a/jstests/regex8.js
+++ b/jstests/core/regex8.js
diff --git a/jstests/regex9.js b/jstests/core/regex9.js
index 896855c6dfb..896855c6dfb 100644
--- a/jstests/regex9.js
+++ b/jstests/core/regex9.js
diff --git a/jstests/regex_embed1.js b/jstests/core/regex_embed1.js
index 61b1b9a14f6..61b1b9a14f6 100644
--- a/jstests/regex_embed1.js
+++ b/jstests/core/regex_embed1.js
diff --git a/jstests/regex_limit.js b/jstests/core/regex_limit.js
index e05dae8ab8b..e05dae8ab8b 100644
--- a/jstests/regex_limit.js
+++ b/jstests/core/regex_limit.js
diff --git a/jstests/regex_options.js b/jstests/core/regex_options.js
index 3febe2575ab..3febe2575ab 100644
--- a/jstests/regex_options.js
+++ b/jstests/core/regex_options.js
diff --git a/jstests/regex_util.js b/jstests/core/regex_util.js
index 86ba8036516..86ba8036516 100644
--- a/jstests/regex_util.js
+++ b/jstests/core/regex_util.js
diff --git a/jstests/regexa.js b/jstests/core/regexa.js
index b0d47190e77..b0d47190e77 100644
--- a/jstests/regexa.js
+++ b/jstests/core/regexa.js
diff --git a/jstests/regexb.js b/jstests/core/regexb.js
index 169841239c8..169841239c8 100644
--- a/jstests/regexb.js
+++ b/jstests/core/regexb.js
diff --git a/jstests/regexc.js b/jstests/core/regexc.js
index f7690c96496..f7690c96496 100644
--- a/jstests/regexc.js
+++ b/jstests/core/regexc.js
diff --git a/jstests/remove.js b/jstests/core/remove.js
index 6800a41fedc..6800a41fedc 100644
--- a/jstests/remove.js
+++ b/jstests/core/remove.js
diff --git a/jstests/remove2.js b/jstests/core/remove2.js
index 2b222d7ecac..6605d83e269 100644
--- a/jstests/remove2.js
+++ b/jstests/core/remove2.js
@@ -20,12 +20,13 @@ function g() {
t.save( { x:[3,4,5,6], z:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } );
t.save( { x:[7,8,9], z:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } );
- t.remove( {x : {$gte:3}, $atomic:x++ } );
-
- assert( !db.getLastError() );
+ var res;
+ res = t.remove( {x : {$gte:3}, $atomic:x++ } );
+
+ assert.writeOK( res );
// $atomic within $and is not allowed.
- //t.remove( {x : {$gte:3}, $and:[{$atomic:true}] } );
- //assert( db.getLastError() );
+ //res = t.remove( {x : {$gte:3}, $and:[{$atomic:true}] } );
+ //assert.writeError( res );
assert( t.findOne({x:3}) == null );
assert( t.findOne({x:8}) == null );
diff --git a/jstests/remove3.js b/jstests/core/remove3.js
index 2a51a6e0fd4..2a51a6e0fd4 100644
--- a/jstests/remove3.js
+++ b/jstests/core/remove3.js
diff --git a/jstests/remove4.js b/jstests/core/remove4.js
index bd007ed4d27..bd007ed4d27 100644
--- a/jstests/remove4.js
+++ b/jstests/core/remove4.js
diff --git a/jstests/remove6.js b/jstests/core/remove6.js
index d843aeeec0f..838ca1c5bfd 100644
--- a/jstests/remove6.js
+++ b/jstests/core/remove6.js
@@ -12,7 +12,7 @@ function pop(){
}
function del(){
- t.remove( { tags : { $in : [ "a" , "c" ] } } );
+ return t.remove( { tags : { $in : [ "a" , "c" ] } } );
}
function test( n , idx ){
@@ -20,9 +20,8 @@ function test( n , idx ){
assert.eq( N , t.count() , n + " A " + idx );
if ( idx )
t.ensureIndex( idx );
- del();
- var e = db.getLastError();
- assert( e == null , "error deleting: " + e );
+ var res = del();
+ assert( !res.hasWriteErrors() , "error deleting: " + res.toString() );
assert.eq( 0 , t.count() , n + " B " + idx );
}
diff --git a/jstests/remove7.js b/jstests/core/remove7.js
index 50c6ac189bc..35662467c04 100644
--- a/jstests/remove7.js
+++ b/jstests/core/remove7.js
@@ -26,10 +26,9 @@ for ( i=0; i<200; i++ ){
t.save( { tags : getTags( 100 ) } );
var q = { tags : { $in : getTags( 10 ) } };
var before = t.find( q ).count();
- t.remove( q );
- var o = db.getLastErrorObj();
+ var res = t.remove( q );
var after = t.find( q ).count();
assert.eq( 0 , after , "not zero after!" );
- assert.isnull( o.err , "error: " + tojson( o ) );
+ assert.writeOK( res );
}
-
+
diff --git a/jstests/remove8.js b/jstests/core/remove8.js
index 3ab53f3289a..3ab53f3289a 100644
--- a/jstests/remove8.js
+++ b/jstests/core/remove8.js
diff --git a/jstests/remove9.js b/jstests/core/remove9.js
index 655594afe8b..655594afe8b 100644
--- a/jstests/remove9.js
+++ b/jstests/core/remove9.js
diff --git a/jstests/remove_justone.js b/jstests/core/remove_justone.js
index e412a13483c..e412a13483c 100644
--- a/jstests/remove_justone.js
+++ b/jstests/core/remove_justone.js
diff --git a/jstests/remove_undefined.js b/jstests/core/remove_undefined.js
index d5344a3a562..d5344a3a562 100644
--- a/jstests/remove_undefined.js
+++ b/jstests/core/remove_undefined.js
diff --git a/jstests/removea.js b/jstests/core/removea.js
index 703d8c4cf92..006342c9795 100644
--- a/jstests/removea.js
+++ b/jstests/core/removea.js
@@ -18,6 +18,6 @@ for( v = 0; v < 2; ++v ) { // Try each index version.
}
// Remove many of the documents; $atomic prevents use of a ClientCursor, which would invoke a
// different bucket deallocation procedure than the one to be tested (see SERVER-4575).
- t.remove( { a:{ $in:toDrop }, $atomic:true } );
- assert( !db.getLastError() );
+ var res = t.remove( { a:{ $in:toDrop }, $atomic:true } );
+ assert.writeOK( res );
}
diff --git a/jstests/removeb.js b/jstests/core/removeb.js
index b6634140081..230a8de012f 100644
--- a/jstests/removeb.js
+++ b/jstests/core/removeb.js
@@ -13,7 +13,6 @@ t.remove({});
for( i = 0; i < 20000; ++i ) {
t.insert( { a:i } );
}
-db.getLastError();
p = startParallelShell(
// Wait until the remove operation (below) begins running.
@@ -23,7 +22,6 @@ p = startParallelShell(
// visited by the remove operation if it has not completed.
'for( i = 20000; i < 40000; ++i ) {' +
' db.jstests_removeb.insert( { a:i } );' +
- ' db.getLastError();' +
' if (i % 1000 == 0) {' +
' print( i-20000 + \" of 20000 documents inserted\" );' +
' }' +
@@ -31,8 +29,8 @@ p = startParallelShell(
);
// Remove using the a:1 index in ascending direction.
-t.remove( { a:{ $gte:0 } } );
-assert( !db.getLastError(), 'The remove operation failed.' );
+var res = t.remove( { a:{ $gte:0 } } );
+assert( !res.hasWriteErrors(), 'The remove operation failed.' );
p();
diff --git a/jstests/removec.js b/jstests/core/removec.js
index 539647c502e..3f0b400215c 100644
--- a/jstests/removec.js
+++ b/jstests/core/removec.js
@@ -17,7 +17,6 @@ function runStartingWith( i ) {
for( i = 0; i < 1100; i += 11 ) {
t.save( { a:runStartingWith( i ) } );
}
-db.getLastError();
// Remove and then reinsert random documents in the background.
s = startParallelShell(
diff --git a/jstests/rename.js b/jstests/core/rename.js
index 51b74047288..51b74047288 100644
--- a/jstests/rename.js
+++ b/jstests/core/rename.js
diff --git a/jstests/rename2.js b/jstests/core/rename2.js
index a06268f1bfb..a06268f1bfb 100644
--- a/jstests/rename2.js
+++ b/jstests/core/rename2.js
diff --git a/jstests/rename3.js b/jstests/core/rename3.js
index 5e1005f8176..5e1005f8176 100644
--- a/jstests/rename3.js
+++ b/jstests/core/rename3.js
diff --git a/jstests/rename4.js b/jstests/core/rename4.js
index 508b8b9321b..d6ded8cbee4 100644
--- a/jstests/rename4.js
+++ b/jstests/core/rename4.js
@@ -2,26 +2,18 @@ t = db.jstests_rename4;
t.drop();
function bad( f ) {
- //Ensure no error to start with
- var lstError = db.getLastError();
- if (lstError)
- assert( false, "Unexpected error : " + lstError );
-
var docsBeforeUpdate = t.find().toArray();
- eval( f );
+ var res = eval( f );
//Ensure error
- var lstError = db.getLastErrorObj();
- if (!lstError.err) {
- print("Error:" + tojson(lstError));
+ if (!res.hasWriteErrors()) {
+ print("Error:" + res.toString());
print("Existing docs (before)")
printjson(docsBeforeUpdate);
print("Existing docs (after)")
printjson(t.find().toArray());
assert( false, "Expected error but didn't get one for: " + f );
}
-
- db.resetError();
}
bad( "t.update( {}, {$rename:{'a':'a'}} )" );
@@ -68,8 +60,8 @@ bad( "t.update( {}, {$rename:{'a':'f.g'}} )" );
function good( start, mod, expected ) {
t.remove({});
t.save( start );
- t.update( {}, mod );
- assert( !db.getLastError() );
+ var res = t.update( {}, mod );
+ assert.writeOK( res );
var got = t.findOne();
delete got._id;
assert.docEq( expected, got );
@@ -132,8 +124,8 @@ t.ensureIndex( {a:1} );
function l( start, mod, query, expected ) {
t.remove({});
t.save( start );
- t.update( {}, mod );
- assert( !db.getLastError() );
+ var res = t.update( {}, mod );
+ assert.writeOK( res );
var got = t.find( query ).hint( {a:1} ).next();
delete got._id;
assert.docEq( expected, got );
diff --git a/jstests/rename5.js b/jstests/core/rename5.js
index 927c767b981..927c767b981 100644
--- a/jstests/rename5.js
+++ b/jstests/core/rename5.js
diff --git a/jstests/rename6.js b/jstests/core/rename6.js
index 17cbf4b80b1..17cbf4b80b1 100644
--- a/jstests/rename6.js
+++ b/jstests/core/rename6.js
diff --git a/jstests/rename7.js b/jstests/core/rename7.js
index 33899957755..33899957755 100644
--- a/jstests/rename7.js
+++ b/jstests/core/rename7.js
diff --git a/jstests/rename8.js b/jstests/core/rename8.js
index 8b955824ea8..8b955824ea8 100644
--- a/jstests/rename8.js
+++ b/jstests/core/rename8.js
diff --git a/jstests/rename_stayTemp.js b/jstests/core/rename_stayTemp.js
index afd77d1289c..afd77d1289c 100644
--- a/jstests/rename_stayTemp.js
+++ b/jstests/core/rename_stayTemp.js
diff --git a/jstests/repair.js b/jstests/core/repair.js
index 5026ec3bcbb..5026ec3bcbb 100644
--- a/jstests/repair.js
+++ b/jstests/core/repair.js
diff --git a/jstests/reversecursor.js b/jstests/core/reversecursor.js
index bb661952fc9..bb661952fc9 100644
--- a/jstests/reversecursor.js
+++ b/jstests/core/reversecursor.js
diff --git a/jstests/role_management_helpers.js b/jstests/core/role_management_helpers.js
index 1cb821975ef..1cb821975ef 100644
--- a/jstests/role_management_helpers.js
+++ b/jstests/core/role_management_helpers.js
diff --git a/jstests/run_program1.js b/jstests/core/run_program1.js
index 7a994b2171a..7a994b2171a 100644
--- a/jstests/run_program1.js
+++ b/jstests/core/run_program1.js
diff --git a/jstests/server1470.js b/jstests/core/server1470.js
index 0bb4d02c933..0bb4d02c933 100644
--- a/jstests/server1470.js
+++ b/jstests/core/server1470.js
diff --git a/jstests/server5346.js b/jstests/core/server5346.js
index f4a692bd16a..f4a692bd16a 100644
--- a/jstests/server5346.js
+++ b/jstests/core/server5346.js
diff --git a/jstests/server7756.js b/jstests/core/server7756.js
index 5a7177ebcc9..5a7177ebcc9 100644
--- a/jstests/server7756.js
+++ b/jstests/core/server7756.js
diff --git a/jstests/server9385.js b/jstests/core/server9385.js
index ee86891ce2a..ee86891ce2a 100644
--- a/jstests/server9385.js
+++ b/jstests/core/server9385.js
diff --git a/jstests/server9547.js b/jstests/core/server9547.js
index 67cacfc22a7..67cacfc22a7 100644
--- a/jstests/server9547.js
+++ b/jstests/core/server9547.js
diff --git a/jstests/set1.js b/jstests/core/set1.js
index d741387af58..d741387af58 100644
--- a/jstests/set1.js
+++ b/jstests/core/set1.js
diff --git a/jstests/set2.js b/jstests/core/set2.js
index 221ee407759..221ee407759 100644
--- a/jstests/set2.js
+++ b/jstests/core/set2.js
diff --git a/jstests/set3.js b/jstests/core/set3.js
index 611abc4e6bf..611abc4e6bf 100644
--- a/jstests/set3.js
+++ b/jstests/core/set3.js
diff --git a/jstests/set4.js b/jstests/core/set4.js
index b37366cdb81..b37366cdb81 100644
--- a/jstests/set4.js
+++ b/jstests/core/set4.js
diff --git a/jstests/set5.js b/jstests/core/set5.js
index afa0d014bde..afa0d014bde 100644
--- a/jstests/set5.js
+++ b/jstests/core/set5.js
diff --git a/jstests/set6.js b/jstests/core/set6.js
index d41e7aba971..d41e7aba971 100644
--- a/jstests/set6.js
+++ b/jstests/core/set6.js
diff --git a/jstests/set7.js b/jstests/core/set7.js
index 68c4d471f58..bf9870eb015 100644
--- a/jstests/set7.js
+++ b/jstests/core/set7.js
@@ -1,6 +1,7 @@
// test $set with array indicies
t = db.jstests_set7;
+var res;
t.drop();
@@ -35,8 +36,8 @@ assert.eq( {"0":4}, t.findOne().a );
t.drop();
t.save( {a:[]} );
-t.update( {}, {$set:{"a.f":1}} );
-assert( db.getLastError() );
+res = t.update( {}, {$set:{"a.f":1}} );
+assert.writeError( res );
assert.eq( [], t.findOne().a );
// Test requiring proper ordering of multiple mods.
@@ -53,15 +54,15 @@ assert.eq( [0,1,2,3,4,5,6,7,8,9,10,11], t.findOne().a );
// SERVER-3750
t.drop();
t.save( {a:[]} );
-t.update( {}, {$set:{"a.1500000":1}} ); // current limit
-assert( db.getLastError() == null );
+res = t.update( {}, {$set:{"a.1500000":1}} ); // current limit
+assert.writeOK( res );
t.drop();
t.save( {a:[]} );
-t.update( {}, {$set:{"a.1500001":1}} ); // 1 over limit
-assert.neq( db.getLastErrorObj(), null );
+res = t.update( {}, {$set:{"a.1500001":1}} ); // 1 over limit
+assert.writeError( res );
t.drop();
t.save( {a:[]} );
-t.update( {}, {$set:{"a.1000000000":1}} ); // way over limit
-assert.neq( db.getLastErrorObj(), null );
+res = t.update( {}, {$set:{"a.1000000000":1}} ); // way over limit
+assert.writeError( res );
diff --git a/jstests/set_param1.js b/jstests/core/set_param1.js
index 555cb520306..555cb520306 100644
--- a/jstests/set_param1.js
+++ b/jstests/core/set_param1.js
diff --git a/jstests/shell1.js b/jstests/core/shell1.js
index 2e6c7292374..2e6c7292374 100644
--- a/jstests/shell1.js
+++ b/jstests/core/shell1.js
diff --git a/jstests/shell_writeconcern.js b/jstests/core/shell_writeconcern.js
index 74247026b31..74247026b31 100644
--- a/jstests/shell_writeconcern.js
+++ b/jstests/core/shell_writeconcern.js
diff --git a/jstests/shellkillop.js b/jstests/core/shellkillop.js
index d903f251f13..d903f251f13 100644
--- a/jstests/shellkillop.js
+++ b/jstests/core/shellkillop.js
diff --git a/jstests/shellspawn.js b/jstests/core/shellspawn.js
index f43e40e9e62..f43e40e9e62 100644
--- a/jstests/shellspawn.js
+++ b/jstests/core/shellspawn.js
diff --git a/jstests/shellstartparallel.js b/jstests/core/shellstartparallel.js
index 59110296b26..290dd3da2f1 100644
--- a/jstests/shellstartparallel.js
+++ b/jstests/core/shellstartparallel.js
@@ -5,12 +5,12 @@ assert.throws(f);
// verify that join works
db.sps.drop();
-join = startParallelShell("sleep(1000); db.sps.insert({x:1}); db.getLastError();");
+join = startParallelShell("sleep(1000); db.sps.insert({x:1});");
join();
assert.eq(1, db.sps.count(), "join problem?");
// test with a throw
-join = startParallelShell("db.sps.insert({x:1}); db.getLastError(); throw 'intentionally_uncaught';");
+join = startParallelShell("db.sps.insert({x:1}); throw 'intentionally_uncaught';");
join();
assert.eq(2, db.sps.count(), "join2 problem?");
diff --git a/jstests/shelltypes.js b/jstests/core/shelltypes.js
index 3f109269b39..3f109269b39 100644
--- a/jstests/shelltypes.js
+++ b/jstests/core/shelltypes.js
diff --git a/jstests/showdiskloc.js b/jstests/core/showdiskloc.js
index d1339c6d238..d1339c6d238 100644
--- a/jstests/showdiskloc.js
+++ b/jstests/core/showdiskloc.js
diff --git a/jstests/skip1.js b/jstests/core/skip1.js
index c620fb01bca..c620fb01bca 100644
--- a/jstests/skip1.js
+++ b/jstests/core/skip1.js
diff --git a/jstests/slice1.js b/jstests/core/slice1.js
index b20e7e48b14..b20e7e48b14 100644
--- a/jstests/slice1.js
+++ b/jstests/core/slice1.js
diff --git a/jstests/sort1.js b/jstests/core/sort1.js
index 12b97728e90..12b97728e90 100644
--- a/jstests/sort1.js
+++ b/jstests/core/sort1.js
diff --git a/jstests/sort10.js b/jstests/core/sort10.js
index e9663f4a55d..e9663f4a55d 100644
--- a/jstests/sort10.js
+++ b/jstests/core/sort10.js
diff --git a/jstests/sort2.js b/jstests/core/sort2.js
index 6dfa8486201..6dfa8486201 100644
--- a/jstests/sort2.js
+++ b/jstests/core/sort2.js
diff --git a/jstests/sort3.js b/jstests/core/sort3.js
index b79f1f60381..b79f1f60381 100644
--- a/jstests/sort3.js
+++ b/jstests/core/sort3.js
diff --git a/jstests/sort4.js b/jstests/core/sort4.js
index 5174b46f41f..5174b46f41f 100644
--- a/jstests/sort4.js
+++ b/jstests/core/sort4.js
diff --git a/jstests/sort5.js b/jstests/core/sort5.js
index b90256ef79d..b90256ef79d 100644
--- a/jstests/sort5.js
+++ b/jstests/core/sort5.js
diff --git a/jstests/sort6.js b/jstests/core/sort6.js
index 027ba7a01f5..027ba7a01f5 100644
--- a/jstests/sort6.js
+++ b/jstests/core/sort6.js
diff --git a/jstests/sort7.js b/jstests/core/sort7.js
index 0b98734e5ff..0b98734e5ff 100644
--- a/jstests/sort7.js
+++ b/jstests/core/sort7.js
diff --git a/jstests/sort8.js b/jstests/core/sort8.js
index 916075502d7..916075502d7 100644
--- a/jstests/sort8.js
+++ b/jstests/core/sort8.js
diff --git a/jstests/sort9.js b/jstests/core/sort9.js
index 62407d6e96d..62407d6e96d 100644
--- a/jstests/sort9.js
+++ b/jstests/core/sort9.js
diff --git a/jstests/sort_numeric.js b/jstests/core/sort_numeric.js
index 807f23dfe8d..807f23dfe8d 100644
--- a/jstests/sort_numeric.js
+++ b/jstests/core/sort_numeric.js
diff --git a/jstests/sorta.js b/jstests/core/sorta.js
index 7c82778a186..7c82778a186 100644
--- a/jstests/sorta.js
+++ b/jstests/core/sorta.js
diff --git a/jstests/sortb.js b/jstests/core/sortb.js
index e16c7d650e6..e16c7d650e6 100644
--- a/jstests/sortb.js
+++ b/jstests/core/sortb.js
diff --git a/jstests/sortc.js b/jstests/core/sortc.js
index f9aa202508b..f9aa202508b 100644
--- a/jstests/sortc.js
+++ b/jstests/core/sortc.js
diff --git a/jstests/sortd.js b/jstests/core/sortd.js
index 963d32b0ca4..963d32b0ca4 100644
--- a/jstests/sortd.js
+++ b/jstests/core/sortd.js
diff --git a/jstests/sortf.js b/jstests/core/sortf.js
index 615791e25a5..615791e25a5 100644
--- a/jstests/sortf.js
+++ b/jstests/core/sortf.js
diff --git a/jstests/sortg.js b/jstests/core/sortg.js
index bde4ad70061..bde4ad70061 100644
--- a/jstests/sortg.js
+++ b/jstests/core/sortg.js
diff --git a/jstests/sorth.js b/jstests/core/sorth.js
index 1072975a3ec..1072975a3ec 100644
--- a/jstests/sorth.js
+++ b/jstests/core/sorth.js
diff --git a/jstests/sorti.js b/jstests/core/sorti.js
index 2e5cfe110d7..2e5cfe110d7 100644
--- a/jstests/sorti.js
+++ b/jstests/core/sorti.js
diff --git a/jstests/sortj.js b/jstests/core/sortj.js
index 7a73829b94e..7a73829b94e 100644
--- a/jstests/sortj.js
+++ b/jstests/core/sortj.js
diff --git a/jstests/sortk.js b/jstests/core/sortk.js
index 3895a34c3ac..3895a34c3ac 100644
--- a/jstests/sortk.js
+++ b/jstests/core/sortk.js
diff --git a/jstests/splitvector.js b/jstests/core/splitvector.js
index d239625de67..eb7059bfcc0 100644
--- a/jstests/splitvector.js
+++ b/jstests/core/splitvector.js
@@ -92,11 +92,10 @@ var case4 = function() {
assert.gt( docSize, 500 , "4a" );
// Fill collection and get split vector for 1MB maxChunkSize
- numDocs = 20000;
+ numDocs = 4500;
for( i=1; i<numDocs; i++ ){
f.save( { x: i, y: filler } );
}
- db.getLastError();
res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 } );
// splitVector aims at getting half-full chunks after split
@@ -119,11 +118,10 @@ f.ensureIndex( { x: 1 } );
var case5 = function() {
// Fill collection and get split vector for 1MB maxChunkSize
- numDocs = 10000;
+ numDocs = 4500;
for( i=1; i<numDocs; i++ ){
f.save( { x: i, y: filler } );
}
- db.getLastError();
res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 , maxSplitPoints: 1} );
assert.eq( true , res.ok , "5a" );
@@ -142,15 +140,14 @@ f.ensureIndex( { x: 1 } );
var case6 = function() {
// Fill collection and get split vector for 1MB maxChunkSize
- numDocs = 10000;
+ numDocs = 2000;
for( i=1; i<numDocs; i++ ){
f.save( { x: i, y: filler } );
}
- db.getLastError();
res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 , maxChunkObjects: 500} );
assert.eq( true , res.ok , "6a" );
- assert.eq( 19 , res.splitKeys.length , "6b" );
+ assert.eq( 3 , res.splitKeys.length , "6b" );
for( i=0; i < res.splitKeys.length; i++ ){
assertFieldNamesMatch( res.splitKeys[i] , {x : 1} );
}
@@ -174,7 +171,6 @@ var case7 = function() {
for( i=1; i<10; i++ ){
f.save( { x: 2, y: filler } );
}
- db.getLastError();
res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 } );
assert.eq( true , res.ok , "7a" );
@@ -206,7 +202,6 @@ var case8 = function() {
f.save( { x: 3, y: filler } );
}
- db.getLastError();
res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 } );
assert.eq( true , res.ok , "8a" );
@@ -230,7 +225,6 @@ var case9 = function() {
f.save( { x: 1 } );
f.save( { x: 2 } );
f.save( { x: 3 } );
- db.getLastError();
assert.eq( 3 , f.count() );
print( f.getFullName() )
diff --git a/jstests/stages_and_hash.js b/jstests/core/stages_and_hash.js
index 42ae0c8e34d..42ae0c8e34d 100644
--- a/jstests/stages_and_hash.js
+++ b/jstests/core/stages_and_hash.js
diff --git a/jstests/stages_and_sorted.js b/jstests/core/stages_and_sorted.js
index fd96ab24153..fd96ab24153 100644
--- a/jstests/stages_and_sorted.js
+++ b/jstests/core/stages_and_sorted.js
diff --git a/jstests/stages_collection_scan.js b/jstests/core/stages_collection_scan.js
index d7de30cf8e7..6adfe971b58 100644
--- a/jstests/stages_collection_scan.js
+++ b/jstests/core/stages_collection_scan.js
@@ -9,7 +9,6 @@ for (var i = 0; i < N; ++i) {
forward = {cscan: {args: {name: "stages_collection_scan", direction: 1}}}
res = db.runCommand({stageDebug: forward});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, N);
assert.eq(res.results[0].foo, 0);
@@ -18,7 +17,6 @@ assert.eq(res.results[49].foo, 49);
// And, backwards.
backward = {cscan: {args: {name: "stages_collection_scan", direction: -1}}}
res = db.runCommand({stageDebug: backward});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, N);
assert.eq(res.results[0].foo, 49);
@@ -27,7 +25,6 @@ assert.eq(res.results[49].foo, 0);
forwardFiltered = {cscan: {args: {name: "stages_collection_scan", direction: 1},
filter: {foo: {$lt: 25}}}}
res = db.runCommand({stageDebug: forwardFiltered});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 25);
assert.eq(res.results[0].foo, 0);
@@ -36,7 +33,6 @@ assert.eq(res.results[24].foo, 24);
backwardFiltered = {cscan: {args: {name: "stages_collection_scan", direction: -1},
filter: {foo: {$lt: 25}}}}
res = db.runCommand({stageDebug: backwardFiltered});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 25);
assert.eq(res.results[0].foo, 24);
diff --git a/jstests/stages_fetch.js b/jstests/core/stages_fetch.js
index 3e2c01df91a..4f84bf05a17 100644
--- a/jstests/stages_fetch.js
+++ b/jstests/core/stages_fetch.js
@@ -17,7 +17,6 @@ ixscan1 = {ixscan: {args:{name: "stages_fetch", keyPattern:{foo:1},
direction: 1},
filter: {bar: 25}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(db.getLastError());
assert.eq(res.ok, 0);
// Now, add a fetch. We should be able to filter on the non-covered field since we fetched the obj.
@@ -28,6 +27,5 @@ ixscan2 = {ixscan: {args:{name: "stages_fetch", keyPattern:{foo:1},
fetch = {fetch: {args: {node: ixscan2}, filter: {bar: 25}}}
res = db.runCommand({stageDebug: fetch});
printjson(res);
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 1);
diff --git a/jstests/stages_ixscan.js b/jstests/core/stages_ixscan.js
index a7cd6bedc3a..a2cf628d551 100644
--- a/jstests/stages_ixscan.js
+++ b/jstests/core/stages_ixscan.js
@@ -16,7 +16,6 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo: 1},
endKey: {}, endKeyInclusive: true,
direction: -1}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 21);
@@ -26,7 +25,6 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo: 1},
endKey: {"" : 30}, endKeyInclusive: false,
direction: 1}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 10);
@@ -36,7 +34,6 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo: 1},
endKey: {"" : 30}, endKeyInclusive: true,
direction: 1}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 11);
@@ -48,7 +45,6 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo: 1},
direction: 1},
filter: {foo: 25}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 1);
@@ -60,7 +56,6 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo:1, baz: 1},
direction: 1},
filter: {baz: 25}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 1);
@@ -72,5 +67,4 @@ ixscan1 = {ixscan: {args:{name: "stages_ixscan", keyPattern:{foo:1, baz: 1},
direction: 1},
filter: {bar: 25}}};
res = db.runCommand({stageDebug: ixscan1});
-assert(db.getLastError());
assert.eq(res.ok, 0);
diff --git a/jstests/stages_limit_skip.js b/jstests/core/stages_limit_skip.js
index 9441e4cd65b..45564c75024 100644
--- a/jstests/stages_limit_skip.js
+++ b/jstests/core/stages_limit_skip.js
@@ -17,7 +17,6 @@ ixscan1 = {ixscan: {args:{name: "stages_limit_skip", keyPattern:{foo: 1},
direction: -1}}};
limit1 = {limit: {args: {node: ixscan1, num: 5}}}
res = db.runCommand({stageDebug: limit1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 5);
assert.eq(res.results[0].foo, 20);
@@ -27,7 +26,6 @@ assert.eq(res.results[4].foo, 16);
// Skip 5 results.
skip1 = {skip: {args: {node: ixscan1, num: 5}}}
res = db.runCommand({stageDebug: skip1});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 16);
assert.eq(res.results[0].foo, 15);
diff --git a/jstests/stages_mergesort.js b/jstests/core/stages_mergesort.js
index 394d60b5b20..ecbed024085 100644
--- a/jstests/stages_mergesort.js
+++ b/jstests/core/stages_mergesort.js
@@ -25,7 +25,6 @@ ixscan2 = {ixscan: {args:{name: "stages_mergesort", keyPattern:{baz: 1, bar:1},
mergesort = {mergeSort: {args: {nodes: [ixscan1, ixscan2], pattern: {bar: 1}}}};
res = db.runCommand({stageDebug: mergesort});
-assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 2 * N);
assert.eq(res.results[0].bar, 0);
diff --git a/jstests/stages_or.js b/jstests/core/stages_or.js
index bb0e02b11d4..bb0e02b11d4 100644
--- a/jstests/stages_or.js
+++ b/jstests/core/stages_or.js
diff --git a/jstests/stages_sort.js b/jstests/core/stages_sort.js
index f7200cbac03..5dd9340b2d6 100644
--- a/jstests/stages_sort.js
+++ b/jstests/core/stages_sort.js
@@ -19,7 +19,6 @@ if (false) {
// Sort with foo ascending.
sort1 = {sort: {args: {node: ixscan1, pattern: {foo: 1}}}};
res = db.runCommand({stageDebug: sort1});
- assert(!db.getLastError());
assert.eq(res.ok, 1);
assert.eq(res.results.length, 21);
assert.eq(res.results[0].foo, 0);
@@ -28,7 +27,6 @@ if (false) {
// Sort with a limit.
//sort2 = {sort: {args: {node: ixscan1, pattern: {foo: 1}, limit: 2}}};
//res = db.runCommand({stageDebug: sort2});
- //assert(!db.getLastError());
//assert.eq(res.ok, 1);
//assert.eq(res.results.length, 2);
//assert.eq(res.results[0].foo, 0);
diff --git a/jstests/stages_text.js b/jstests/core/stages_text.js
index 8407ffe1e14..8407ffe1e14 100644
--- a/jstests/stages_text.js
+++ b/jstests/core/stages_text.js
diff --git a/jstests/stats.js b/jstests/core/stats.js
index 08a74a00fb7..08a74a00fb7 100644
--- a/jstests/stats.js
+++ b/jstests/core/stats.js
diff --git a/jstests/storageDetailsCommand.js b/jstests/core/storageDetailsCommand.js
index 1340a1038d5..1340a1038d5 100644
--- a/jstests/storageDetailsCommand.js
+++ b/jstests/core/storageDetailsCommand.js
diff --git a/jstests/storefunc.js b/jstests/core/storefunc.js
index f5d1c3be48a..b4cda6f52f0 100644
--- a/jstests/storefunc.js
+++ b/jstests/core/storefunc.js
@@ -1,12 +1,13 @@
// Use a private sister database to avoid conflicts with other tests that use system.js
var testdb = db.getSisterDB("storefunc");
+var res;
s = testdb.system.js;
s.remove({});
assert.eq( 0 , s.count() , "setup - A" );
-s.save( { _id : "x" , value : "3" } );
-assert.isnull( testdb.getLastError() , "setup - B" );
+res = s.save( { _id : "x" , value : "3" } );
+assert( !res.hasWriteErrors() , "setup - B" );
assert.eq( 1 , s.count() , "setup - C" );
s.remove( { _id : "x" } );
diff --git a/jstests/string_with_nul_bytes.js b/jstests/core/string_with_nul_bytes.js
index a1f6e395dd2..a1f6e395dd2 100644
--- a/jstests/string_with_nul_bytes.js
+++ b/jstests/core/string_with_nul_bytes.js
diff --git a/jstests/sub1.js b/jstests/core/sub1.js
index 9e643f811fd..9e643f811fd 100644
--- a/jstests/sub1.js
+++ b/jstests/core/sub1.js
diff --git a/jstests/temp_cleanup.js b/jstests/core/temp_cleanup.js
index e827083d605..e827083d605 100644
--- a/jstests/temp_cleanup.js
+++ b/jstests/core/temp_cleanup.js
diff --git a/jstests/testminmax.js b/jstests/core/testminmax.js
index 803f1b48a0b..803f1b48a0b 100644
--- a/jstests/testminmax.js
+++ b/jstests/core/testminmax.js
diff --git a/jstests/touch1.js b/jstests/core/touch1.js
index f7a0878f2e6..f7a0878f2e6 100644
--- a/jstests/touch1.js
+++ b/jstests/core/touch1.js
diff --git a/jstests/ts1.js b/jstests/core/ts1.js
index 30f7882e863..30f7882e863 100644
--- a/jstests/ts1.js
+++ b/jstests/core/ts1.js
diff --git a/jstests/type1.js b/jstests/core/type1.js
index 518e36728e7..518e36728e7 100644
--- a/jstests/type1.js
+++ b/jstests/core/type1.js
diff --git a/jstests/type2.js b/jstests/core/type2.js
index 820607e0b30..820607e0b30 100644
--- a/jstests/type2.js
+++ b/jstests/core/type2.js
diff --git a/jstests/type3.js b/jstests/core/type3.js
index 82a8b8ae7fc..82a8b8ae7fc 100644
--- a/jstests/type3.js
+++ b/jstests/core/type3.js
diff --git a/jstests/uniqueness.js b/jstests/core/uniqueness.js
index ce19ad08d82..56107e7ce25 100644
--- a/jstests/uniqueness.js
+++ b/jstests/core/uniqueness.js
@@ -1,3 +1,4 @@
+var res;
t = db.jstests_uniqueness;
@@ -5,42 +6,39 @@ t.drop();
// test uniqueness of _id
-t.save( { _id : 3 } );
-assert( !db.getLastError(), 1 );
+res = t.save( { _id : 3 } );
+assert.writeOK( res );
// this should yield an error
-t.insert( { _id : 3 } );
-assert( db.getLastError() , 2);
+res = t.insert( { _id : 3 } );
+assert.writeError( res );
assert( t.count() == 1, "hmmm");
-t.insert( { _id : 4, x : 99 } );
-assert( !db.getLastError() , 3);
+res = t.insert( { _id : 4, x : 99 } );
+assert.writeOK( res );
// this should yield an error
-t.update( { _id : 4 } , { _id : 3, x : 99 } );
-assert( db.getLastError() , 4);
+res = t.update( { _id : 4 } , { _id : 3, x : 99 } );
+assert.writeError( res );
assert( t.findOne( {_id:4} ), 5 );
-// Check for an error message when we index and there are dups
+// Check for an error message when we index and there are dups
db.jstests_uniqueness2.drop();
db.jstests_uniqueness2.insert({a:3});
db.jstests_uniqueness2.insert({a:3});
assert( db.jstests_uniqueness2.count() == 2 , 6) ;
-db.resetError();
-db.jstests_uniqueness2.ensureIndex({a:1}, true);
-assert( db.getLastError() , 7);
-assert( db.getLastError().match( /E11000/ ) );
+res = db.jstests_uniqueness2.ensureIndex({a:1}, true);
+assert.writeError( res );
+assert( res.getWriteError().errmsg.match( /E11000/ ) );
-// Check for an error message when we index in the background and there are dups
+// Check for an error message when we index in the background and there are dups
db.jstests_uniqueness2.drop();
db.jstests_uniqueness2.insert({a:3});
db.jstests_uniqueness2.insert({a:3});
assert( db.jstests_uniqueness2.count() == 2 , 6) ;
-assert( !db.getLastError() );
-db.resetError();
-db.jstests_uniqueness2.ensureIndex({a:1}, {unique:true,background:true});
-assert( db.getLastError() , 7);
-assert( db.getLastError().match( /E11000/ ) );
+res = db.jstests_uniqueness2.ensureIndex({a:1}, {unique:true,background:true});
+assert.writeError( res );
+assert( res.getWriteError().errmsg.match( /E11000/ ) );
/* Check that if we update and remove _id, it gets added back by the DB */
diff --git a/jstests/unset.js b/jstests/core/unset.js
index f3cdcf03deb..f3cdcf03deb 100644
--- a/jstests/unset.js
+++ b/jstests/core/unset.js
diff --git a/jstests/unset2.js b/jstests/core/unset2.js
index e1dc445fcb8..501f9f16331 100644
--- a/jstests/unset2.js
+++ b/jstests/core/unset2.js
@@ -1,3 +1,5 @@
+var res;
+
t = db.unset2;
t.drop();
@@ -18,6 +20,6 @@ assert.eq( ["a","b",null,3,4,5], t.findOne().a );
t.drop();
t.save( {a:["a","b","c","d","e"]} );
-t.update( {}, {$unset:{"a.2":1},$set:{"a.2":4}} );
-assert( db.getLastError() );
-assert.eq( ["a","b","c","d","e"], t.findOne().a ); \ No newline at end of file
+res = t.update( {}, {$unset:{"a.2":1},$set:{"a.2":4}} );
+assert.writeError( res );
+assert.eq( ["a","b","c","d","e"], t.findOne().a );
diff --git a/jstests/update.js b/jstests/core/update.js
index 37bf6378c64..37bf6378c64 100644
--- a/jstests/update.js
+++ b/jstests/core/update.js
diff --git a/jstests/update2.js b/jstests/core/update2.js
index 654914c1f45..654914c1f45 100644
--- a/jstests/update2.js
+++ b/jstests/core/update2.js
diff --git a/jstests/update3.js b/jstests/core/update3.js
index 995c6e67b45..995c6e67b45 100644
--- a/jstests/update3.js
+++ b/jstests/core/update3.js
diff --git a/jstests/update5.js b/jstests/core/update5.js
index 2728000f2d4..2728000f2d4 100644
--- a/jstests/update5.js
+++ b/jstests/core/update5.js
diff --git a/jstests/update6.js b/jstests/core/update6.js
index 05fc5b223d9..05fc5b223d9 100644
--- a/jstests/update6.js
+++ b/jstests/core/update6.js
diff --git a/jstests/update7.js b/jstests/core/update7.js
index b893121080f..b893121080f 100644
--- a/jstests/update7.js
+++ b/jstests/core/update7.js
diff --git a/jstests/update8.js b/jstests/core/update8.js
index 2388ff85c9d..2388ff85c9d 100644
--- a/jstests/update8.js
+++ b/jstests/core/update8.js
diff --git a/jstests/update9.js b/jstests/core/update9.js
index 45b9e2d0e26..45b9e2d0e26 100644
--- a/jstests/update9.js
+++ b/jstests/core/update9.js
diff --git a/jstests/update_addToSet.js b/jstests/core/update_addToSet.js
index da930555267..da930555267 100644
--- a/jstests/update_addToSet.js
+++ b/jstests/core/update_addToSet.js
diff --git a/jstests/update_addToSet2.js b/jstests/core/update_addToSet2.js
index cb168f8d15e..cb168f8d15e 100644
--- a/jstests/update_addToSet2.js
+++ b/jstests/core/update_addToSet2.js
diff --git a/jstests/update_addToSet3.js b/jstests/core/update_addToSet3.js
index e9da58eb6e0..e9da58eb6e0 100644
--- a/jstests/update_addToSet3.js
+++ b/jstests/core/update_addToSet3.js
diff --git a/jstests/update_arraymatch1.js b/jstests/core/update_arraymatch1.js
index 521271d7f85..521271d7f85 100644
--- a/jstests/update_arraymatch1.js
+++ b/jstests/core/update_arraymatch1.js
diff --git a/jstests/update_arraymatch2.js b/jstests/core/update_arraymatch2.js
index c07a61c378c..c07a61c378c 100644
--- a/jstests/update_arraymatch2.js
+++ b/jstests/core/update_arraymatch2.js
diff --git a/jstests/update_arraymatch3.js b/jstests/core/update_arraymatch3.js
index 116ac6be2e3..116ac6be2e3 100644
--- a/jstests/update_arraymatch3.js
+++ b/jstests/core/update_arraymatch3.js
diff --git a/jstests/update_arraymatch4.js b/jstests/core/update_arraymatch4.js
index 5abd0aa3bf0..5abd0aa3bf0 100644
--- a/jstests/update_arraymatch4.js
+++ b/jstests/core/update_arraymatch4.js
diff --git a/jstests/update_arraymatch5.js b/jstests/core/update_arraymatch5.js
index aff1a0323ef..aff1a0323ef 100644
--- a/jstests/update_arraymatch5.js
+++ b/jstests/core/update_arraymatch5.js
diff --git a/jstests/update_arraymatch6.js b/jstests/core/update_arraymatch6.js
index 8892e6fcc68..1fd6d32ab16 100644
--- a/jstests/update_arraymatch6.js
+++ b/jstests/core/update_arraymatch6.js
@@ -1,10 +1,11 @@
+var res;
t = db.jstests_update_arraymatch6;
t.drop();
function doTest() {
t.save( {a: [{id: 1, x: [5,6,7]}, {id: 2, x: [8,9,10]}]} );
- t.update({'a.id': 1}, {$set: {'a.$.x': [1,1,1]}});
- assert.automsg( "!db.getLastError()" );
+ res = t.update({'a.id': 1}, {$set: {'a.$.x': [1,1,1]}});
+ assert.writeOK( res )
assert.eq.automsg( "1", "t.findOne().a[ 0 ].x[ 0 ]" );
}
diff --git a/jstests/update_arraymatch7.js b/jstests/core/update_arraymatch7.js
index 5621f60c39e..5621f60c39e 100644
--- a/jstests/update_arraymatch7.js
+++ b/jstests/core/update_arraymatch7.js
diff --git a/jstests/update_arraymatch8.js b/jstests/core/update_arraymatch8.js
index 1e8ce377862..1e8ce377862 100644
--- a/jstests/update_arraymatch8.js
+++ b/jstests/core/update_arraymatch8.js
diff --git a/jstests/update_bit_examples.js b/jstests/core/update_bit_examples.js
index f277630a7da..dd31119400f 100644
--- a/jstests/update_bit_examples.js
+++ b/jstests/core/update_bit_examples.js
@@ -1,24 +1,25 @@
// Basic examples for $bit
+var res;
var coll = db.update_bit;
coll.drop();
// $bit and
coll.remove({})
coll.save({_id:1, a:NumberInt(2)});
-coll.update({}, {$bit: {a: {and: NumberInt(4)}}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$bit: {a: {and: NumberInt(4)}}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, 0)
// $bit or
coll.remove({})
coll.save({_id:1, a:NumberInt(2)});
-coll.update({}, {$bit: {a: {or: NumberInt(4)}}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$bit: {a: {or: NumberInt(4)}}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, 6)
// $bit xor
coll.remove({})
coll.save({_id:1, a:NumberInt(0)});
-coll.update({}, {$bit: {a: {xor: NumberInt(4)}}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$bit: {a: {xor: NumberInt(4)}}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, 4)
diff --git a/jstests/update_blank1.js b/jstests/core/update_blank1.js
index a2344035dc3..94a083b306f 100644
--- a/jstests/update_blank1.js
+++ b/jstests/core/update_blank1.js
@@ -4,7 +4,7 @@ t.drop();
orig = { "" : 1 , _id : 2 , "a" : 3 , "b" : 4 };
t.insert( orig );
-t.update( {} , { $set : { "c" : 5 } } );
-print( db.getLastError() );
+var res = t.update( {} , { $set : { "c" : 5 } } );
+print( res );
orig["c"] = 5;
-assert.docEq( orig , t.findOne() , "after $set" ); // SERVER-2651 \ No newline at end of file
+assert.docEq( orig , t.findOne() , "after $set" ); // SERVER-2651
diff --git a/jstests/update_currentdate_examples.js b/jstests/core/update_currentdate_examples.js
index 055bd3089da..f6270c62871 100644
--- a/jstests/update_currentdate_examples.js
+++ b/jstests/core/update_currentdate_examples.js
@@ -1,24 +1,25 @@
// Basic examples for $currentDate
+var res;
var coll = db.update_currentdate;
coll.drop();
// $currentDate default
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$currentDate: {a: true}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$currentDate: {a: true}})
+assert.writeOK(res);
assert(coll.findOne().a.constructor == Date)
// $currentDate type = date
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$currentDate: {a: {$type: "date"}}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$currentDate: {a: {$type: "date"}}})
+assert.writeOK(res);
assert(coll.findOne().a.constructor == Date)
// $currentDate type = timestamp
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$currentDate: {a: {$type: "timestamp"}}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$currentDate: {a: {$type: "timestamp"}}})
+assert.writeOK(res);
assert(coll.findOne().a.constructor == Timestamp)
diff --git a/jstests/core/update_dbref.js b/jstests/core/update_dbref.js
new file mode 100644
index 00000000000..e978a4888c5
--- /dev/null
+++ b/jstests/core/update_dbref.js
@@ -0,0 +1,40 @@
+// Test that we can update DBRefs, but not dbref fields outside a DBRef
+
+var res;
+t = db.jstests_update_dbref;
+t.drop();
+
+res = t.save({_id:1, a: new DBRef("a", "b")});
+assert(!res.hasWriteErrors(), "failed to save dbref");
+assert.docEq({_id:1, a: new DBRef("a", "b")}, t.findOne());
+
+res = t.update({}, {$set: {"a.$id": 2}});
+assert(!res.hasWriteErrors(), "a.$id update");
+assert.docEq({_id:1, a: new DBRef("a", 2)}, t.findOne());
+
+res = t.update({}, {$set: {"a.$ref": "b"}});
+assert(!res.hasWriteErrors(), "a.$ref update");
+
+assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
+
+// Bad updates
+res = t.update({}, {$set: {"$id": 3}});
+assert.writeError(res);
+assert(/\$id/.test(res.getWriteError()), "expected bad update because of $id");
+assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
+
+res = t.update({}, {$set: {"$ref": "foo"}});
+assert.writeError(res);
+assert(/\$ref/.test(res.getWriteError()), "expected bad update because of $ref");
+assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
+
+res = t.update({}, {$set: {"$db": "aDB"}});
+assert.writeError(res);
+assert(/\$db/.test(res.getWriteError()), "expected bad update because of $db");
+assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
+
+res = t.update({}, {$set: {"b.$id": 2}});
+assert(res.hasWriteErrors(), "b.$id update should fail -- doc:" + tojson(t.findOne()) + " result:" + res.toString());
+
+res = t.update({}, {$set: {"b.$ref": 2}});
+assert(res.hasWriteErrors(), "b.$ref update should fail -- doc:" + tojson(t.findOne()) + " result:" + res.toString());
diff --git a/jstests/update_invalid1.js b/jstests/core/update_invalid1.js
index 7c94507f560..7c94507f560 100644
--- a/jstests/update_invalid1.js
+++ b/jstests/core/update_invalid1.js
diff --git a/jstests/update_min_max_examples.js b/jstests/core/update_min_max_examples.js
index ef84cff3635..ab4948c10ab 100644
--- a/jstests/update_min_max_examples.js
+++ b/jstests/core/update_min_max_examples.js
@@ -1,31 +1,32 @@
// Basic examples for $min/$max
+var res;
var coll = db.update_min_max;
coll.drop();
// $min for number
coll.insert({_id:1, a:2});
-coll.update({_id:1}, {$min: {a: 1}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({_id:1}, {$min: {a: 1}})
+assert.writeOK(res);
assert.eq(coll.findOne({_id:1}).a, 1)
// $max for number
coll.insert({_id:2, a:2});
-coll.update({_id:2}, {$max: {a: 1}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({_id:2}, {$max: {a: 1}})
+assert.writeOK(res);
assert.eq(coll.findOne({_id:2}).a, 2)
// $min for Date
coll.insert({_id:3, a: new Date()});
var origDoc = coll.findOne({_id:3})
sleep(2)
-coll.update({_id:3}, {$min: {a: new Date()}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({_id:3}, {$min: {a: new Date()}})
+assert.writeOK(res);
assert.eq(coll.findOne({_id:3}).a, origDoc.a)
// $max for Date
coll.insert({_id:4, a: new Date()});
sleep(2)
var newDate = new Date();
-coll.update({_id:4}, {$max: {a: newDate}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({_id:4}, {$max: {a: newDate}})
+assert.writeOK(res);
assert.eq(coll.findOne({_id:4}).a, newDate)
diff --git a/jstests/update_mul_examples.js b/jstests/core/update_mul_examples.js
index a57fa0a3380..dc2ec182774 100644
--- a/jstests/update_mul_examples.js
+++ b/jstests/core/update_mul_examples.js
@@ -1,24 +1,25 @@
// Basic examples for $mul (multiply)
+var res;
var coll = db.update_mul;
coll.drop();
// $mul positive
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$mul: {a: 10}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$mul: {a: 10}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, 20)
// $mul negative
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$mul: {a: -10}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$mul: {a: -10}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, -20)
// $mul zero
coll.remove({})
coll.save({_id:1, a:2});
-coll.update({}, {$mul: {a: 0}})
-assert.gleSuccess(coll.getDB())
+res = coll.update({}, {$mul: {a: 0}})
+assert.writeOK(res);
assert.eq(coll.findOne().a, 0)
diff --git a/jstests/update_multi3.js b/jstests/core/update_multi3.js
index 903d8265b63..903d8265b63 100644
--- a/jstests/update_multi3.js
+++ b/jstests/core/update_multi3.js
diff --git a/jstests/update_multi4.js b/jstests/core/update_multi4.js
index e81a19a5feb..e81a19a5feb 100644
--- a/jstests/update_multi4.js
+++ b/jstests/core/update_multi4.js
diff --git a/jstests/update_multi5.js b/jstests/core/update_multi5.js
index 46ef8f36da5..46ef8f36da5 100644
--- a/jstests/update_multi5.js
+++ b/jstests/core/update_multi5.js
diff --git a/jstests/update_multi6.js b/jstests/core/update_multi6.js
index dcc1ff04034..57733c37e38 100644
--- a/jstests/update_multi6.js
+++ b/jstests/core/update_multi6.js
@@ -1,3 +1,4 @@
+var res;
t = db.update_multi6
t.drop();
@@ -5,6 +6,6 @@ t.drop();
t.update( { _id : 1 } , { _id : 1 , x : 1 , y : 2 } , true , false );
assert( t.findOne( { _id : 1 } ) , "A" )
-t.update( { _id : 2 } , { _id : 2 , x : 1 , y : 2 } , true , true );
-assert( db.getLastError() , "B: " + tojson(db.getLastErrorCmd()) );
+res = t.update( { _id : 2 } , { _id : 2 , x : 1 , y : 2 } , true , true );
+assert.writeError( res );
diff --git a/jstests/update_replace.js b/jstests/core/update_replace.js
index 0f9ef8fbe39..ff9312baa95 100644
--- a/jstests/update_replace.js
+++ b/jstests/core/update_replace.js
@@ -3,48 +3,50 @@
// 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.forceWriteMode(db.getMongo().writeMode());
t = conn.getDB(db.getName()).jstests_update_replace;
t.drop();
var myDB = t.getDB();
+var res;
// Bypass validation in shell so we can test the server.
conn._skipValidation = true;
// Should not allow "." in field names
-t.save({_id:1, "a.a":1})
-assert.gleError(myDB, "a.a");
+res = t.save({_id:1, "a.a":1})
+assert(res.hasWriteErrors(), "a.a");
// Should not allow "." in field names, embedded
-t.save({_id:1, a :{"a.a":1}})
-assert.gleError(myDB, "a: a.a");
+res = t.save({_id:1, a :{"a.a":1}})
+assert(res.hasWriteErrors(), "a: a.a");
// Should not allow "$"-prefixed field names, caught before "." check
-t.save({_id:1, $a :{"a.a":1}})
-assert.gleError(myDB, "$a: a.a");
+res = t.save({_id:1, $a :{"a.a":1}})
+assert(res.hasWriteErrors(), "$a: a.a");
// Should not allow "$"-prefixed field names
-t.save({_id:1, $a: 1})
-assert.gleError(myDB, "$a");
+res = t.save({_id:1, $a: 1})
+assert(res.hasWriteErrors(), "$a");
// _id validation checks
// Should not allow regex _id
-t.save({_id: /a/})
-assert.gleError(myDB, "_id regex");
+res = t.save({_id: /a/})
+assert(res.hasWriteErrors(), "_id regex");
// Should not allow regex _id, even if not first
-t.save({a:2, _id: /a/})
-assert.gleError(myDB, "a _id regex");
+res = t.save({a:2, _id: /a/})
+assert(res.hasWriteErrors(), "a _id regex");
// Should not allow array _id
-t.save({_id: [9]})
-assert.gleError(myDB, "_id array");
+res = t.save({_id: [9]})
+assert(res.hasWriteErrors(), "_id array");
// This is fine since _id isn't a top level field
-t.save({a :{ _id: [9]}})
-assert.gleSuccess(myDB, "embedded _id array");
+res = t.save({a :{ _id: [9]}})
+assert(!res.hasWriteErrors(), "embedded _id array");
// This is fine since _id isn't a top level field
-t.save({b:1, a :{ _id: [9]}})
-assert.gleSuccess(myDB, "b embedded _id array");
+res = t.save({b:1, a :{ _id: [9]}})
+assert(!res.hasWriteErrors(), "b embedded _id array");
diff --git a/jstests/update_setOnInsert.js b/jstests/core/update_setOnInsert.js
index be215ab408d..105e3493bb7 100644
--- a/jstests/update_setOnInsert.js
+++ b/jstests/core/update_setOnInsert.js
@@ -1,5 +1,6 @@
// This tests that $setOnInsert works and allow setting the _id
t = db.update_setOnInsert;
+var res;
db.setProfilingLevel( 2 );
@@ -34,14 +35,11 @@ dotest( true );
// Cases for SERVER-9958 -- Allow _id $setOnInsert during insert (if upsert:true, and not doc found)
t.drop();
-t.update( {_id: 1} , { $setOnInsert: { "_id.a": new Date() } } , true );
-assert.gleError(db, function(gle) {
- return "$setOnInsert _id.a - " + tojson(gle) + tojson(t.findOne()) } );
+res = t.update( {_id: 1} , { $setOnInsert: { "_id.a": new Date() } } , true );
+assert(res.hasWriteErrors(), "$setOnInsert _id.a - " + res.toString() + tojson(t.findOne()));
-t.update( {"_id.a": 4} , { $setOnInsert: { "_id.b": 1 } } , true );
-assert.gleError(db, function(gle) {
- return "$setOnInsert _id.b - " + tojson(gle) + tojson(t.findOne()) } );
+res = t.update( {"_id.a": 4} , { $setOnInsert: { "_id.b": 1 } } , true );
+assert(res.hasWriteErrors(), "$setOnInsert _id.b - " + res.toString() + tojson(t.findOne()));
-t.update( {"_id.a": 4} , { $setOnInsert: { "_id": {a:4, b:1} } } , true );
-assert.gleError(db, function(gle) {
- return "$setOnInsert _id 3 - " + tojson(gle) + tojson(t.findOne()) } );
+res = t.update( {"_id.a": 4} , { $setOnInsert: { "_id": {a:4, b:1} } } , true );
+assert(res.hasWriteErrors(), "$setOnInsert _id 3 - " + res.toString() + tojson(t.findOne()));
diff --git a/jstests/updatea.js b/jstests/core/updatea.js
index 40b900d0c9d..bcf50892420 100644
--- a/jstests/updatea.js
+++ b/jstests/core/updatea.js
@@ -1,38 +1,39 @@
+var res;
t = db.updatea;
t.drop();
orig = { _id : 1 , a : [ { x : 1 , y : 2 } , { x : 10 , y : 11 } ] }
-t.save( orig )
-assert.gleSuccess(db, "orig");
+res = t.save( orig )
+assert.writeOK(res);
// SERVER-181
-t.update( {} , { $set : { "a.0.x" : 3 } } )
-assert.gleSuccess(db, "a.0.x");
+res = t.update( {} , { $set : { "a.0.x" : 3 } } )
+assert.writeOK(res);
orig.a[0].x = 3;
assert.eq( orig , t.findOne() , "A1" );
-t.update( {} , { $set : { "a.1.z" : 17 } } )
-assert.gleSuccess(db, "a.1.z");
+res = t.update( {} , { $set : { "a.1.z" : 17 } } )
+assert.writeOK(res);
orig.a[1].z = 17;
assert.eq( orig , t.findOne() , "A2" );
// SERVER-273
-t.update( {} , { $unset : { "a.1.y" : 1 } } )
-assert.gleSuccess(db, "a.1.y");
+res = t.update( {} , { $unset : { "a.1.y" : 1 } } )
+assert.writeOK(res);
delete orig.a[1].y
assert.eq( orig , t.findOne() , "A3" );
// SERVER-333
t.drop();
orig = { _id : 1 , comments : [ { name : "blah" , rate_up : 0 , rate_ups : [] } ] }
-t.save( orig );
-assert.gleSuccess(db, "save");
+res = t.save( orig );
+assert.writeOK(res);
-t.update( {} , { $inc: { "comments.0.rate_up" : 1 } , $push: { "comments.0.rate_ups" : 99 } } )
-assert.gleSuccess(db, "comments.0.rate_up");
+res = t.update( {} , { $inc: { "comments.0.rate_up" : 1 } , $push: { "comments.0.rate_ups" : 99 } } )
+assert.writeOK(res);
orig.comments[0].rate_up++;
orig.comments[0].rate_ups.push( 99 )
assert.eq( orig , t.findOne() , "B1" )
@@ -43,25 +44,25 @@ for ( i=0; i<12; i++ )
orig.a.push( i );
-t.save( orig );
-assert.gleSuccess(db, "C1");
+res = t.save( orig );
+assert.writeOK(res);
assert.eq( orig , t.findOne() , "C1" );
-t.update( {} , { $inc: { "a.0" : 1 } } );
-assert.gleSuccess(db, "C2");
+res = t.update( {} , { $inc: { "a.0" : 1 } } );
+assert.writeOK(res);
orig.a[0]++;
assert.eq( orig , t.findOne() , "C2" );
-t.update( {} , { $inc: { "a.10" : 1 } } );
-assert.gleSuccess(db, "a.10");
+res = t.update( {} , { $inc: { "a.10" : 1 } } );
+assert.writeOK(res);
orig.a[10]++;
// SERVER-3218
t.drop()
-t.insert({"a":{"c00":1}, 'c':2})
-t.update({"c":2}, {'$inc':{'a.c000':1}})
-assert.gleSuccess(db, "D1");
+t.insert({"a":{"c00":1}, 'c':2})
+res = t.update({"c":2}, {'$inc':{'a.c000':1}})
+assert.writeOK(res);
assert.eq( { "c00" : 1 , "c000" : 1 } , t.findOne().a , "D1" )
diff --git a/jstests/updateb.js b/jstests/core/updateb.js
index d85e19a36bc..d85e19a36bc 100644
--- a/jstests/updateb.js
+++ b/jstests/core/updateb.js
diff --git a/jstests/updatec.js b/jstests/core/updatec.js
index 0c77b8b3cda..0c77b8b3cda 100644
--- a/jstests/updatec.js
+++ b/jstests/core/updatec.js
diff --git a/jstests/updated.js b/jstests/core/updated.js
index c202e8d435f..c202e8d435f 100644
--- a/jstests/updated.js
+++ b/jstests/core/updated.js
diff --git a/jstests/updatee.js b/jstests/core/updatee.js
index 85ba37c5c05..85ba37c5c05 100644
--- a/jstests/updatee.js
+++ b/jstests/core/updatee.js
diff --git a/jstests/updatef.js b/jstests/core/updatef.js
index 69425932f19..e1164f2b939 100644
--- a/jstests/updatef.js
+++ b/jstests/core/updatef.js
@@ -12,7 +12,6 @@ for( i = 0; i < 1000; ++i ) {
}
t.save( {a:0,b:[]} );
-db.getLastError();
// Repeatedly rename jstests_updatef to jstests_updatef_ and back. This will
// invalidate the jstests_updatef_actual NamespaceDetailsTransient object.
s = startParallelShell( "for( i=0; i < 100; ++i ) { db.jstests_updatef.renameCollection( 'jstests_updatef_' ); db.jstests_updatef_.renameCollection( 'jstests_updatef' ); }" );
diff --git a/jstests/updateg.js b/jstests/core/updateg.js
index f8d452f71b2..f8d452f71b2 100644
--- a/jstests/updateg.js
+++ b/jstests/core/updateg.js
diff --git a/jstests/core/updateh.js b/jstests/core/updateh.js
new file mode 100644
index 00000000000..4dfdba724e0
--- /dev/null
+++ b/jstests/core/updateh.js
@@ -0,0 +1,33 @@
+// Disallow $ in field names - SERVER-3730
+var res;
+
+t = db.jstest_updateh
+t.drop()
+
+t.insert( {x:1} )
+
+res = t.update( {x:1}, {$set: {y:1}} ) // ok
+assert.writeOK( res )
+
+res = t.update( {x:1}, {$set: {$z:1}} ) // not ok
+assert.writeError( res )
+
+// TODO: This shouldn't be supported, and it isn't with the new update framework, but we
+// currently don't have a good way to check which mode we are in. When we do have that, add
+// this test guarded under that condition. Or, when we remove the old update path just enable
+// this test.
+//
+// res = t.update( {x:1}, {$set: {'a.$b':1}} ) // not ok
+// assert.writeError( res )
+
+res = t.update( {x:1}, {$unset: {$z:1}} ) // unset ok to remove bad fields
+assert.writeOK( res )
+
+res = t.update( {x:1}, {$inc: {$z:1}} ) // not ok
+assert.writeError( res )
+
+res = t.update( {x:1}, {$pushAll: {$z:[1,2,3]}} ) // not ok
+assert.writeError( res )
+
+res = t.update( {x:1}, {$pushAll: {z:[1,2,3]}} ) // ok
+assert.writeOK( res )
diff --git a/jstests/updatei.js b/jstests/core/updatei.js
index e45b3fde5bb..e45b3fde5bb 100644
--- a/jstests/updatei.js
+++ b/jstests/core/updatei.js
diff --git a/jstests/updatej.js b/jstests/core/updatej.js
index 6a70a4c2d51..6a70a4c2d51 100644
--- a/jstests/updatej.js
+++ b/jstests/core/updatej.js
diff --git a/jstests/updatek.js b/jstests/core/updatek.js
index b96f3138a81..b96f3138a81 100644
--- a/jstests/updatek.js
+++ b/jstests/core/updatek.js
diff --git a/jstests/updatel.js b/jstests/core/updatel.js
index be4b95cf99f..7253872232c 100644
--- a/jstests/updatel.js
+++ b/jstests/core/updatel.js
@@ -5,6 +5,7 @@
// If no array element position from a query is available to substitute for the positional operator
// setinel ('$'), the update fails with an error. SERVER-6669 SERVER-4713
+var res;
t = db.jstests_updatel;
t.drop();
@@ -12,8 +13,8 @@ t.drop();
// The collection is empty, forcing an upsert. In this case the query has no array position match
// to substiture for the positional operator. SERVER-4713
-t.update( {}, { $set:{ 'a.$.b':1 } }, true );
-assert( db.getLastError(), "An error is reported." );
+res = t.update( {}, { $set:{ 'a.$.b':1 } }, true );
+assert( res.hasWriteErrors(), "An error is reported." );
assert.eq( 0, t.count(), "No upsert occurred." );
@@ -23,15 +24,15 @@ t.save( { _id:0 } );
// Now, with an existing document, trigger an update rather than an upsert. The query has no array
// position match to substiture for the positional operator. SERVER-6669
-t.update( {}, { $set:{ 'a.$.b':1 } } );
-assert( db.getLastError(), "An error is reported." );
+res = t.update( {}, { $set:{ 'a.$.b':1 } } );
+assert( res.hasWriteErrors(), "An error is reported." );
assert.eq( [ { _id:0 } ], t.find().toArray(), "No update occurred." );
// Now, try with an update by _id (without a query array match).
-t.update( { _id:0 }, { $set:{ 'a.$.b':1 } } );
-assert( db.getLastError(), "An error is reported." );
+res = t.update( { _id:0 }, { $set:{ 'a.$.b':1 } } );
+assert( res.hasWriteErrors(), "An error is reported." );
assert.eq( [ { _id:0 } ], t.find().toArray(), "No update occurred." );
@@ -43,6 +44,6 @@ t.save( { _id:0, a:[ { b:{ c:1 } } ] } );
// Now, attempt to apply an update with two nested positional operators. There is a positional
// query match for the first positional operator but not the second. Note that dollar sign
// substitution for multiple positional opertors is not implemented (SERVER-831).
-t.update( { 'a.b.c':1 }, { $set:{ 'a.$.b.$.c':2 } } );
-assert( db.getLastError(), "An error is reported" );
+res = t.update( { 'a.b.c':1 }, { $set:{ 'a.$.b.$.c':2 } } );
+assert( res.hasWriteErrors(), "An error is reported" );
assert.eq( [ { _id:0, a:[ { b:{ c:1 } } ] } ], t.find().toArray(), "No update occurred." );
diff --git a/jstests/updatem.js b/jstests/core/updatem.js
index 3d46d2a15f3..3d46d2a15f3 100644
--- a/jstests/updatem.js
+++ b/jstests/core/updatem.js
diff --git a/jstests/core/upsert1.js b/jstests/core/upsert1.js
new file mode 100644
index 00000000000..85999a189f5
--- /dev/null
+++ b/jstests/core/upsert1.js
@@ -0,0 +1,52 @@
+// tests to make sure that the new _id is returned after the insert
+var l;
+t = db.upsert1;
+t.drop();
+
+// make sure the new _id is returned when $mods are used
+l = t.update( { x : 1 } , { $inc : { y : 1 } } , true );
+assert( l.getUpsertedId() , "A1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id.str , t.findOne()._id.str , "A2" );
+
+// make sure the new _id is returned on a replacement (no $mod in update)
+l = t.update( { x : 2 } , { x : 2 , y : 3 } , true );
+assert( l.getUpsertedId() , "B1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id.str , t.findOne( { x : 2 } )._id.str , "B2" );
+assert.eq( 2 , t.find().count() , "B3" );
+
+// use the _id from the query for the insert
+l = t.update({_id:3}, {$set: {a:'123'}}, true)
+assert( l.getUpsertedId() , "C1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id , 3 , "C2 - " + tojson(l) );
+
+// test with an embedded doc for the _id field
+l = t.update({_id:{a:1}}, {$set: {a:123}}, true)
+assert( l.getUpsertedId() , "D1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id , {a:1} , "D2 - " + tojson(l) );
+
+// test with a range query
+l = t.update({_id: {$gt:100}}, {$set: {a:123}}, true)
+assert( l.getUpsertedId() , "E1 - " + tojson(l) );
+assert.neq( l.getUpsertedId()._id , 100 , "E2 - " + tojson(l) );
+
+// test with an _id query
+l = t.update({_id: 1233}, {$set: {a:123}}, true)
+assert( l.getUpsertedId() , "F1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id , 1233 , "F2 - " + tojson(l) );
+
+// test with an embedded _id query
+l = t.update({_id: {a:1, b:2}}, {$set: {a:123}}, true)
+assert( l.getUpsertedId() , "G1 - " + tojson(l) );
+assert.eq( l.getUpsertedId()._id , {a:1, b:2} , "G2 - " + tojson(l) );
+
+// test with no _id inserted
+db.no_id.drop();
+db.createCollection("no_id", {autoIndexId:false})
+l = db.no_id.update({foo:1}, {$set:{a:1}}, true)
+assert( l.getUpsertedId() , "H1 - " + tojson(l) );
+assert( !l.hasWriteErrors(), "H1.5 No error expected - " + tojson(l) )
+assert.eq( 0, db.no_id.getIndexes().length, "H2" );
+assert.eq( 1, db.no_id.count(), "H3" );
+var newDoc = db.no_id.findOne();
+delete newDoc["_id"];
+assert.eq( { foo : 1, a : 1 }, newDoc, "H4" );
diff --git a/jstests/upsert2.js b/jstests/core/upsert2.js
index 7184ed807d1..7184ed807d1 100644
--- a/jstests/upsert2.js
+++ b/jstests/core/upsert2.js
diff --git a/jstests/core/upsert3.js b/jstests/core/upsert3.js
new file mode 100644
index 00000000000..d23fbabc680
--- /dev/null
+++ b/jstests/core/upsert3.js
@@ -0,0 +1,52 @@
+// tests to make sure no dup fields are created when using query to do upsert
+var res;
+t = db.upsert3;
+t.drop();
+
+//make sure we validate query
+res = t.update( {a: {"a.a": 1}} , {$inc: {y: 1}} , true );
+assert.writeError( res, "a.a.a-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+res = t.update( {a: {$a: 1}} , {$inc: {y: 1}} , true );
+assert.writeError(res, "a.$a-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+// make sure the new _id is not duplicated
+res = t.update( {"a.b": 1, a: {a: 1, b: 1}} , {$inc: {y: 1}} , true );
+assert.writeError(res, "a.b-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+res = t.update( {"_id.a": 1, _id: {a: 1, b: 1}} , {$inc : {y: 1}} , true );
+assert.writeError(res, "_id-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+res = t.update( {_id: {a: 1, b: 1}, "_id.a": 1} , { $inc: {y: 1}} , true );
+assert.writeError(res, "_id-2 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+// Should be redundant, but including from SERVER-11363
+res = t.update( {_id: {a: 1, b: 1}, "_id.a": 1} , {$setOnInsert: {y: 1}} , true );
+assert.writeError(res, "_id-3 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+//Should be redundant, but including from SERVER-11514
+res = t.update( {"a": {}, "a.c": 2} , {$set: {x: 1}}, true );
+assert.writeError(res, "a.c-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+// Should be redundant, but including from SERVER-4830
+res = t.update( {'a': {b: 1}, 'a.c': 1}, {$inc: {z: 1}}, true );
+assert.writeError(res, "a-1 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+// Should be redundant, but including from SERVER-4830
+res = t.update( {a: 1, "a.b": 1, a: [1, {b: 1}]}, {$inc: {z: 1}}, true );
+assert.writeError(res, "a-2 - " + res.toString() + " doc:" + tojson(t.findOne()));
+
+// Replacement tests
+// Query is ignored for replacements, except _id field.
+res = t.update( {r: {a: 1, b: 1}, "r.a": 1} , {y: 1} , true );
+assert.writeOK(res);
+assert(t.findOne().y, 1, "inserted doc missing field")
+var docMinusId = t.findOne();
+delete docMinusId._id
+assert.docEq({y: 1}, docMinusId, "r-1")
+t.drop()
+
+res = t.update( {_id: {a:1, b:1}, "_id.a": 1} , {y: 1} , true );
+assert.writeOK(res);
+assert.docEq({_id: {a: 1, b: 1}, y: 1}, t.findOne(), "_id-4")
+t.drop()
diff --git a/jstests/core/upsert4.js b/jstests/core/upsert4.js
new file mode 100644
index 00000000000..7020837adf6
--- /dev/null
+++ b/jstests/core/upsert4.js
@@ -0,0 +1,37 @@
+// tests to ensure fields in $and conditions are created when using the query to do upsert
+var res;
+coll = db.upsert4;
+coll.drop();
+
+res = coll.update({_id: 1, $and: [{c: 1}, {d: 1}], a: 12} , {$inc: {y: 1}} , true);
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, a: 12, y: 1})
+
+coll.remove({})
+res = coll.update({$and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+
+coll.remove({})
+res = coll.update({$and: [{c: 1}, {d: 1}, {$or: [{x:1}]}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, x:1})
+
+coll.remove({})
+res = coll.update({$and: [{c: 1}, {d: 1}], $or: [{x: 1}, {x: 2}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeOK(res);;
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+
+coll.remove({})
+res = coll.update({r: {$gt: 3}, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+
+coll.remove({})
+res = coll.update({r: /s/, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeOK(res);
+assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
+
+coll.remove({})
+res = coll.update({c:2, $and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
+assert.writeError(res);
diff --git a/jstests/core/use_power_of_2.js b/jstests/core/use_power_of_2.js
new file mode 100644
index 00000000000..8eb24233cf1
--- /dev/null
+++ b/jstests/core/use_power_of_2.js
@@ -0,0 +1,52 @@
+/*
+ * This test ensures that the usePowerOf2 user flag effectively reuses space.
+ */
+
+// prepare a doc of 14K
+var doc = { _id: new Object(), data: "a" };
+var bigDoc = { _id: new Object(), data: "a" };
+
+while (doc.data.length < 14 * 1024) doc.data += "a";
+while (bigDoc.data.length < 15 * 1024) bigDoc.data += "a";
+
+var collName = "usepower1";
+var t = db.getCollection(collName);
+
+function checkStorageSize(expectedSize, sameLoc) {
+ t.insert(doc);
+ assert.eq(t.stats().size, expectedSize, "size should be expected");
+
+ var oldLoc = t.find()._addSpecial("$showDiskLoc" , true).toArray()[0].$diskLoc;
+
+ // Remvoe smaller doc, insert a bigger one.
+ t.remove(doc);
+ t.insert(bigDoc);
+
+ var newLoc = t.find()._addSpecial("$showDiskLoc" , true).toArray()[0].$diskLoc;
+
+ // Check the diskloc of two docs.
+ assert.eq(oldLoc.file == newLoc.file && oldLoc.offset == newLoc.offset, sameLoc);
+}
+
+t.drop();
+db.createCollection(collName);
+var res = db.runCommand( { "collMod" : collName , "usePowerOf2Sizes" : false } );
+assert( res.ok, "collMod failed" );
+checkStorageSize(15344, false); // 15344 = 14369 (bsonsize) + overhead
+
+t.drop();
+db.createCollection(collName);
+var res = db.runCommand( { "collMod" : collName , "usePowerOf2Sizes" : true } );
+assert( res.ok, "collMod failed" );
+checkStorageSize(16 * 1023, true); // power of 2
+
+
+// Create collection with flag
+t.drop();
+db.runCommand({"create" : collName, "flags" : 0 });
+checkStorageSize(15344, false);
+
+t.drop();
+db.runCommand({"create" : collName, "flags" : 1 });
+checkStorageSize(16 * 1023, true); // power of 2
+
diff --git a/jstests/useindexonobjgtlt.js b/jstests/core/useindexonobjgtlt.js
index 06e94a812f6..06e94a812f6 100755
--- a/jstests/useindexonobjgtlt.js
+++ b/jstests/core/useindexonobjgtlt.js
diff --git a/jstests/user_management_helpers.js b/jstests/core/user_management_helpers.js
index 50707f584ab..50707f584ab 100644
--- a/jstests/user_management_helpers.js
+++ b/jstests/core/user_management_helpers.js
diff --git a/jstests/validate_cmd_ns.js b/jstests/core/validate_cmd_ns.js
index b13a0d98159..b13a0d98159 100644
--- a/jstests/validate_cmd_ns.js
+++ b/jstests/core/validate_cmd_ns.js
diff --git a/jstests/validate_user_documents.js b/jstests/core/validate_user_documents.js
index 825e1e7de11..825e1e7de11 100644
--- a/jstests/validate_user_documents.js
+++ b/jstests/core/validate_user_documents.js
diff --git a/jstests/core/verify_update_mods.js b/jstests/core/verify_update_mods.js
new file mode 100644
index 00000000000..d7a80061e6e
--- /dev/null
+++ b/jstests/core/verify_update_mods.js
@@ -0,0 +1,83 @@
+// Verify update mods exist
+var res;
+t = db.update_mods;
+t.drop();
+
+t.save({_id:1});
+res = t.update({}, {$set:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$unset:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$inc:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$mul:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$push:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$pushAll:{a:[1]}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$addToSet:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$pull:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$pop:{a:true}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$rename:{a:"b"}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$bit:{a:{and:NumberLong(1)}}})
+assert.writeOK(res);
+t.remove({})
+
+// SERVER-3223 test $bit can do an upsert
+t.update({_id:1}, {$bit:{a:{and:NumberLong(3)}}}, true);
+assert.eq(t.findOne({_id:1}).a, NumberLong(0), "$bit upsert with and");
+t.update({_id:2}, {$bit:{b:{or:NumberLong(3)}}}, true);
+assert.eq(t.findOne({_id:2}).b, NumberLong(3), "$bit upsert with or (long)");
+t.update({_id:3}, {$bit:{"c.d":{or:NumberInt(3)}}}, true);
+assert.eq(t.findOne({_id:3}).c.d, NumberInt(3), "$bit upsert with or (int)");
+t.remove({});
+
+t.save({_id:1});
+res = t.update({}, {$currentDate:{a:true}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$max:{a:1}})
+assert.writeOK(res);
+t.remove({})
+
+t.save({_id:1});
+res = t.update({}, {$min:{a:1}})
+assert.writeOK(res);
+t.remove({})
diff --git a/jstests/where1.js b/jstests/core/where1.js
index 7ff20a53620..7ff20a53620 100644
--- a/jstests/where1.js
+++ b/jstests/core/where1.js
diff --git a/jstests/where2.js b/jstests/core/where2.js
index 9262b3076b3..9262b3076b3 100644
--- a/jstests/where2.js
+++ b/jstests/core/where2.js
diff --git a/jstests/where3.js b/jstests/core/where3.js
index c062ed11513..c062ed11513 100644
--- a/jstests/where3.js
+++ b/jstests/core/where3.js
diff --git a/jstests/where4.js b/jstests/core/where4.js
index 61ec3771bed..61ec3771bed 100644
--- a/jstests/where4.js
+++ b/jstests/core/where4.js
diff --git a/jstests/orm.js b/jstests/orm.js
deleted file mode 100644
index dae75e4a534..00000000000
--- a/jstests/orm.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Test dropping during a $or yield SERVER-3555
-
-t = db.jstests_orm;
-t.drop();
-
-clauses = [];
-for( i = 0; i < 10; ++i ) {
- clauses.push( {a:{$lte:(i+1)*5000/10},i:49999} );
- clauses.push( {b:{$lte:(i+1)*5000/10},i:49999} );
-}
-
-p = startParallelShell( 'for( i = 0; i < 15; ++i ) { sleep( 1000 ); db.jstests_orm.drop() }' );
-for( j = 0; j < 5; ++j ) {
- for( i = 0; i < 5000; ++i ) {
- t.save( {a:i,i:i} );
- t.save( {b:i,i:i} );
- }
- t.ensureIndex( {a:1} );
- t.ensureIndex( {b:1} );
- try {
- t.find( {$or:clauses} ).itcount();
- t.find( {$or:clauses} ).count();
- t.update( {$or:clauses}, {} );
- t.remove( {$or:clauses} );
- } catch ( e ) {
- }
- db.getLastError();
-}
-p();
diff --git a/jstests/orn.js b/jstests/orn.js
deleted file mode 100644
index c900bb8669f..00000000000
--- a/jstests/orn.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// Test dropping during an $or distinct yield SERVER-3555
-
-t = db.jstests_orn;
-t.drop();
-
-clauses = [];
-for( i = 0; i < 10; ++i ) {
- clauses.push( {a:{$lte:(i+1)*5000/10},i:49999} );
- clauses.push( {b:{$lte:(i+1)*5000/10},i:49999} );
-}
-
-p = startParallelShell( 'for( i = 0; i < 15; ++i ) { sleep( 1000 ); db.jstests_orn.drop() }' );
-for( j = 0; j < 5; ++j ) {
- for( i = 0; i < 5000; ++i ) {
- t.save( {a:i,i:i} );
- t.save( {b:i,i:i} );
- }
- t.ensureIndex( {a:1} );
- t.ensureIndex( {b:1} );
- t.distinct('a',{$or:clauses});
-}
-p();
diff --git a/jstests/queryoptimizer1.js b/jstests/queryoptimizer1.js
deleted file mode 100644
index 671bf0ae96b..00000000000
--- a/jstests/queryoptimizer1.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-t = db.queryoptimizer1;
-t.drop();
-
-for ( i=0; i<1000; i++ )
- for ( j=0; j<20; j++ )
- t.save( { a : i , b : i , c : j } )
-
-
-t.ensureIndex( { a : 1 } )
-t.ensureIndex( { b : 1 } )
-
-for ( ; i<2000; i++ )
- for ( j=0; j<20; j++ )
- t.save( { a : i , b : i , c : j } )
-
-
-printjson( t.find( { a : 50 , b : 50 , c : 6 } ).explain() );
-
-for ( var i=0; i<10000; i++ ){
- a = t.find( { a : 50 , b : 50 , c : i % 20 } ).toArray();
-}
-
-printjson( t.find( { a : 50 , b : 50 , c : 6 } ).explain() );
-assert.eq( 1 , t.find( { a : 50 , b : 50 , c : 6 } ).count() );
-
-t.drop(); \ No newline at end of file
diff --git a/jstests/queryoptimizer5.js b/jstests/queryoptimizer5.js
deleted file mode 100644
index 62875d65dec..00000000000
--- a/jstests/queryoptimizer5.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Don't crash attempting to retry additional query plans if a recorded plan failed because a cursor was dropped.
-
-t = db.jstests_queryoptimizer5;
-t.drop();
-
-function reset() {
- t.drop();
- for( var i = 0; i < 5000; ++i ) {
- t.save({a:i,b:i});
- }
- t.ensureIndex({a:1});
- t.ensureIndex({b:1});
-}
-
-s = startParallelShell( "for( i = 0; i < 30; ++i ) { sleep( 200 ); db.jstests_queryoptimizer5.drop(); }" );
-
-for( var i = 0; i < 10; ++i ) {
- try {
- reset();
- t.find( {$or:[{a:{$gte:0},b:{$gte:0}}]} ).batchSize( 10000 ).itcount();
- t.find( {$or:[{a:{$gte:0},b:{$gte:0}}]} ).batchSize( 10000 ).itcount();
- } catch (e) {
-// printjson(e);
- }
-}
-
-s();
diff --git a/jstests/slowNightly/opcounters_legacy.js b/jstests/slowNightly/opcounters_legacy.js
index 893150f4014..7db520a109f 100644
--- a/jstests/slowNightly/opcounters_legacy.js
+++ b/jstests/slowNightly/opcounters_legacy.js
@@ -3,7 +3,7 @@
// Remember the global 'db' var
var lastDB = db;
var mongo = new Mongo(db.getMongo().host);
-mongo.useWriteCommands = function() { return false; }
+mongo.writeMode = function() { return "legacy"; }
db = mongo.getDB(db.toString());
var t = db.opcounters;
diff --git a/jstests/core/opcounters.js b/jstests/slowNightly/opcounters_write_cmd.js
index 4cbe5866773..47a1bc63515 100644
--- a/jstests/core/opcounters.js
+++ b/jstests/slowNightly/opcounters_write_cmd.js
@@ -1,6 +1,11 @@
// Test that opcounters get incremented properly.
-var t = db.opcounters;
-var isMongos = ("isdbgrid" == db.runCommand("ismaster").msg);
+
+var mongo = new Mongo(db.getMongo().host);
+mongo.forceWriteMode("commands");
+var newdb = mongo.getDB(db.toString());
+
+var t = newdb.opcounters;
+var isMongos = ("isdbgrid" == newdb.runCommand("ismaster").msg);
var opCounters;
var res;
@@ -23,43 +28,35 @@ assert(t.getDB().getMongo().useWriteCommands(), "test is not running with write
t.drop();
// Single insert, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.insert({_id:0});
assert.writeOK(res);
-assert.eq(opCounters.insert + 1, db.serverStatus().opcounters.insert);
+assert.eq(opCounters.insert + 1, newdb.serverStatus().opcounters.insert);
// Bulk insert, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.insert([{_id:1},{_id:2}])
assert.writeOK(res);
-assert.eq(opCounters.insert + 2, db.serverStatus().opcounters.insert);
+assert.eq(opCounters.insert + 2, newdb.serverStatus().opcounters.insert);
// Single insert, with error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.insert({_id:0})
assert.writeError(res);
-if (t.getMongo().writeMode() == "commands")
- assert.eq(opCounters.insert + 1, db.serverStatus().opcounters.insert);
-else
- assert.eq(opCounters.insert, db.serverStatus().opcounters.insert);
+assert.eq(opCounters.insert + 1, newdb.serverStatus().opcounters.insert);
// Bulk insert, with error, ordered.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.insert([{_id:3},{_id:3},{_id:4}])
assert.writeError(res);
-if (t.getMongo().writeMode() == "commands")
- assert.eq(opCounters.insert + 2, db.serverStatus().opcounters.insert);
-else
- assert.eq(opCounters.insert + 1, db.serverStatus().opcounters.insert);
+assert.eq(opCounters.insert + 2, newdb.serverStatus().opcounters.insert);
+
// Bulk insert, with error, unordered.
var continueOnErrorFlag = 1;
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.insert([{_id:5},{_id:5},{_id:6}], continueOnErrorFlag)
assert.writeError(res);
-if (t.getMongo().writeMode() == "commands")
- assert.eq(opCounters.insert + 3, db.serverStatus().opcounters.insert);
-else
- assert.eq(opCounters.insert + 2, db.serverStatus().opcounters.insert);
+assert.eq(opCounters.insert + 3, newdb.serverStatus().opcounters.insert);
//
// 2. Update.
@@ -69,16 +66,16 @@ t.drop();
t.insert({_id:0});
// Update, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.update({_id:0}, {$set:{a:1}});
assert.writeOK(res);
-assert.eq(opCounters.update + 1, db.serverStatus().opcounters.update);
+assert.eq(opCounters.update + 1, newdb.serverStatus().opcounters.update);
// Update, with error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.update({_id:0}, {$set:{_id:1}});
assert.writeError(res);
-assert.eq(opCounters.update + 1, db.serverStatus().opcounters.update);
+assert.eq(opCounters.update + 1, newdb.serverStatus().opcounters.update);
//
// 3. Delete.
@@ -88,16 +85,16 @@ t.drop();
t.insert([{_id:0},{_id:1}]);
// Delete, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.remove({_id:0});
assert.writeOK(res);
-assert.eq(opCounters.delete + 1, db.serverStatus().opcounters.delete);
+assert.eq(opCounters.delete + 1, newdb.serverStatus().opcounters.delete);
// Delete, with error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.remove({_id:{$invalidOp:1}});
assert.writeError(res);
-assert.eq(opCounters.delete + 1, db.serverStatus().opcounters.delete);
+assert.eq(opCounters.delete + 1, newdb.serverStatus().opcounters.delete);
//
// 4. Query.
@@ -110,14 +107,14 @@ t.drop();
t.insert({_id:0});
// Query, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
t.findOne();
-assert.eq(opCounters.query + 1, db.serverStatus().opcounters.query);
+assert.eq(opCounters.query + 1, newdb.serverStatus().opcounters.query);
// Query, with error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
assert.throws(function() { t.findOne({_id:{$invalidOp:1}}) });
-assert.eq(opCounters.query + (isMongos ? 0 : 1), db.serverStatus().opcounters.query);
+assert.eq(opCounters.query + (isMongos ? 0 : 1), newdb.serverStatus().opcounters.query);
//
// 5. Getmore.
@@ -129,10 +126,10 @@ t.drop();
t.insert([{_id:0},{_id:1},{_id:2}]);
// Getmore, no error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
t.find().batchSize(2).toArray(); // 3 documents, batchSize=2 => 1 query + 1 getmore
-assert.eq(opCounters.query + 1, db.serverStatus().opcounters.query);
-assert.eq(opCounters.getmore + 1, db.serverStatus().opcounters.getmore);
+assert.eq(opCounters.query + 1, newdb.serverStatus().opcounters.query);
+assert.eq(opCounters.getmore + 1, newdb.serverStatus().opcounters.getmore);
// Getmore, with error (TODO implement when SERVER-5813 is resolved).
@@ -148,22 +145,22 @@ t.drop();
t.insert({_id:0})
// Command, recognized, no error.
-opCounters = db.serverStatus().opcounters;
-assert.eq(opCounters.command + 1, db.serverStatus().opcounters.command); // "serverStatus" counted
+opCounters = newdb.serverStatus().opcounters;
+assert.eq(opCounters.command + 1, newdb.serverStatus().opcounters.command); // "serverStatus" counted
// Command, recognized, with error.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.runCommand("count", {query:{$invalidOp:1}});
assert.eq(0, res.ok);
assert.eq(opCounters.command + 2,
- db.serverStatus().opcounters.command); // "serverStatus", "count" counted
+ newdb.serverStatus().opcounters.command); // "serverStatus", "count" counted
// Command, unrecognized.
-opCounters = db.serverStatus().opcounters;
+opCounters = newdb.serverStatus().opcounters;
res = t.runCommand("command that doesn't exist");
assert.eq(0, res.ok);
-//assert.eq(opCounters.command + 1, db.serverStatus().opcounters.command); // "serverStatus" counted
+//assert.eq(opCounters.command + 1, newdb.serverStatus().opcounters.command); // "serverStatus" counted
// TODO Replace below with above when SERVER-9038 is resolved (mongos counts unrecognized commands)
-assert.eq(opCounters.command + (isMongos ? 2 : 1), db.serverStatus().opcounters.command);
+assert.eq(opCounters.command + (isMongos ? 2 : 1), newdb.serverStatus().opcounters.command);
// Command, recognized, counting suppressed (TODO implement when SERVER-9038 is resolved).
diff --git a/jstests/update_dbref.js b/jstests/update_dbref.js
deleted file mode 100644
index bf31566fc28..00000000000
--- a/jstests/update_dbref.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// Test that we can update DBRefs, but not dbref fields outside a DBRef
-
-t = db.jstests_update_dbref;
-t.drop();
-
-t.save({_id:1, a: new DBRef("a", "b")});
-assert.gleSuccess(db, "failed to save dbref");
-assert.docEq({_id:1, a: new DBRef("a", "b")}, t.findOne());
-
-t.update({}, {$set: {"a.$id": 2}});
-assert.gleSuccess(db, "a.$id update");
-assert.docEq({_id:1, a: new DBRef("a", 2)}, t.findOne());
-
-t.update({}, {$set: {"a.$ref": "b"}});
-assert.gleSuccess(db, "a.$ref update");
-
-assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
-
-// Bad updates
-t.update({}, {$set: {"$id": 3}});
-assert.gleErrorRegex(db, /\$id/, "expected bad update because of $id")
-assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
-
-t.update({}, {$set: {"$ref": "foo"}});
-assert.gleErrorRegex(db, /\$ref/, "expected bad update because of $ref")
-assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
-
-t.update({}, {$set: {"$db": "aDB"}});
-assert.gleErrorRegex(db, /\$db/, "expected bad update because of $db")
-assert.docEq({_id:1, a: new DBRef("b", 2)}, t.findOne());
-
-t.update({}, {$set: {"b.$id": 2}});
-assert.gleError(db, function() { return "b.$id update -- doc:" + tojson(t.findOne())});
-
-t.update({}, {$set: {"b.$ref": 2}});
-assert.gleError(db, function() { return "b.$ref update -- doc:" + tojson(t.findOne())});
diff --git a/jstests/updateh.js b/jstests/updateh.js
deleted file mode 100644
index 2a39f6a0975..00000000000
--- a/jstests/updateh.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Disallow $ in field names - SERVER-3730
-
-t = db.jstest_updateh
-t.drop()
-
-t.insert( {x:1} )
-
-t.update( {x:1}, {$set: {y:1}} ) // ok
-e = db.getLastErrorObj()
-assert.eq( e.err, null )
-
-t.update( {x:1}, {$set: {$z:1}} ) // not ok
-e = db.getLastErrorObj()
-assert( e.err != null )
-
-// TODO: This shouldn't be supported, and it isn't with the new update framework, but we
-// currently don't have a good way to check which mode we are in. When we do have that, add
-// this test guarded under that condition. Or, when we remove the old update path just enable
-// this test.
-//
-// t.update( {x:1}, {$set: {'a.$b':1}} ) // not ok
-// e = db.getLastErrorObj()
-// assert( e.err != null )
-
-t.update( {x:1}, {$unset: {$z:1}} ) // unset ok to remove bad fields
-e = db.getLastErrorObj()
-assert.eq( e.err, null )
-
-t.update( {x:1}, {$inc: {$z:1}} ) // not ok
-e = db.getLastErrorObj()
-assert( e.err != null )
-
-t.update( {x:1}, {$pushAll: {$z:[1,2,3]}} ) // not ok
-e = db.getLastErrorObj()
-assert( e.err != null )
-
-t.update( {x:1}, {$pushAll: {z:[1,2,3]}} ) // ok
-e = db.getLastErrorObj()
-assert.eq( e.err, null )
diff --git a/jstests/upsert1.js b/jstests/upsert1.js
deleted file mode 100644
index 21f24ae8281..00000000000
--- a/jstests/upsert1.js
+++ /dev/null
@@ -1,59 +0,0 @@
-// tests to make sure that the new _id is returned after the insert
-t = db.upsert1;
-t.drop();
-
-// make sure the new _id is returned when $mods are used
-t.update( { x : 1 } , { $inc : { y : 1 } } , true );
-l = db.getLastErrorCmd();
-assert( l.upserted , "A1 - " + tojson(l) );
-assert.eq( l.upserted.str , t.findOne()._id.str , "A2" );
-
-// make sure the new _id is returned on a replacement (no $mod in update)
-t.update( { x : 2 } , { x : 2 , y : 3 } , true );
-l = db.getLastErrorCmd();
-assert( l.upserted , "B1 - " + tojson(l) );
-assert.eq( l.upserted.str , t.findOne( { x : 2 } )._id.str , "B2" );
-assert.eq( 2 , t.find().count() , "B3" );
-
-// use the _id from the query for the insert
-t.update({_id:3}, {$set: {a:'123'}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "C1 - " + tojson(l) );
-assert.eq( l.upserted , 3 , "C2 - " + tojson(l) );
-
-// test with an embedded doc for the _id field
-t.update({_id:{a:1}}, {$set: {a:123}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "D1 - " + tojson(l) );
-assert.eq( l.upserted , {a:1} , "D2 - " + tojson(l) );
-
-// test with a range query
-t.update({_id: {$gt:100}}, {$set: {a:123}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "E1 - " + tojson(l) );
-assert.neq( l.upserted , 100 , "E2 - " + tojson(l) );
-
-// test with an _id query
-t.update({_id: 1233}, {$set: {a:123}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "F1 - " + tojson(l) );
-assert.eq( l.upserted , 1233 , "F2 - " + tojson(l) );
-
-// test with an embedded _id query
-t.update({_id: {a:1, b:2}}, {$set: {a:123}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "G1 - " + tojson(l) );
-assert.eq( l.upserted , {a:1, b:2} , "G2 - " + tojson(l) );
-
-// test with no _id inserted
-db.no_id.drop();
-db.createCollection("no_id", {autoIndexId:false})
-db.no_id.update({foo:1}, {$set:{a:1}}, true)
-l = db.getLastErrorCmd();
-assert( l.upserted , "H1 - " + tojson(l) );
-assert( !l.err, "H1.5 No error expected - " + tojson(l) )
-assert.eq( 0, db.no_id.getIndexes().length, "H2" );
-assert.eq( 1, db.no_id.count(), "H3" );
-var newDoc = db.no_id.findOne();
-delete newDoc["_id"];
-assert.eq( { foo : 1, a : 1 }, newDoc, "H4" );
diff --git a/jstests/upsert3.js b/jstests/upsert3.js
deleted file mode 100644
index 34e37bde33d..00000000000
--- a/jstests/upsert3.js
+++ /dev/null
@@ -1,60 +0,0 @@
-// tests to make sure no dup fields are created when using query to do upsert
-t = db.upsert3;
-t.drop();
-
-//make sure we validate query
-t.update( {a: {"a.a": 1}} , {$inc: {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "a.a.a-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-t.update( {a: {$a: 1}} , {$inc: {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "a.$a-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-// make sure the new _id is not duplicated
-t.update( {"a.b": 1, a: {a: 1, b: 1}} , {$inc: {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "a.b-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-t.update( {"_id.a": 1, _id: {a: 1, b: 1}} , {$inc : {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "_id-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-t.update( {_id: {a: 1, b: 1}, "_id.a": 1} , { $inc: {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "_id-2 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-// Should be redundant, but including from SERVER-11363
-t.update( {_id: {a: 1, b: 1}, "_id.a": 1} , {$setOnInsert: {y: 1}} , true );
-assert.gleError(db, function(gle) {
- return "_id-3 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-//Should be redundant, but including from SERVER-11514
-t.update( {"a": {}, "a.c": 2} , {$set: {x: 1}}, true );
-assert.gleError(db, function(gle) {
- return "a.c-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-// Should be redundant, but including from SERVER-4830
-t.update( {'a': {b: 1}, 'a.c': 1}, {$inc: {z: 1}}, true );
-assert.gleError(db, function(gle) {
- return "a-1 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-// Should be redundant, but including from SERVER-4830
-t.update( {a: 1, "a.b": 1, a: [1, {b: 1}]}, {$inc: {z: 1}}, true );
-assert.gleError(db, function(gle) {
- return "a-2 - " + tojson(gle) + " doc:" + tojson(t.findOne()) });
-
-// Replacement tests
-// Query is ignored for replacements, except _id field.
-t.update( {r: {a: 1, b: 1}, "r.a": 1} , {y: 1} , true );
-assert.gleSuccess(db, "r-1");
-assert(t.findOne().y, 1, "inserted doc missing field")
-var docMinusId = t.findOne();
-delete docMinusId._id
-assert.docEq({y: 1}, docMinusId, "r-1")
-t.drop()
-
-t.update( {_id: {a:1, b:1}, "_id.a": 1} , {y: 1} , true );
-assert.gleSuccess(db, "_id-4");
-assert.docEq({_id: {a: 1, b: 1}, y: 1}, t.findOne(), "_id-4")
-t.drop() \ No newline at end of file
diff --git a/jstests/upsert4.js b/jstests/upsert4.js
deleted file mode 100644
index cbf7f2646f3..00000000000
--- a/jstests/upsert4.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// tests to ensure fields in $and conditions are created when using the query to do upsert
-coll = db.upsert4;
-coll.drop();
-
-coll.update({_id: 1, $and: [{c: 1}, {d: 1}], a: 12} , {$inc: {y: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, a: 12, y: 1})
-
-coll.remove({})
-coll.update({$and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
-
-coll.remove({})
-coll.update({$and: [{c: 1}, {d: 1}, {$or: [{x:1}]}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1, x:1})
-
-coll.remove({})
-coll.update({$and: [{c: 1}, {d: 1}], $or: [{x: 1}, {x: 2}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
-
-coll.remove({})
-coll.update({r: {$gt: 3}, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
-
-coll.remove({})
-coll.update({r: /s/, $and: [{c: 1}, {d: 1}], $or: [{x:1}, {x:2}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleSuccess(db, "");
-assert.docEq(coll.findOne(), {_id: 1, c: 1, d: 1})
-
-coll.remove({})
-coll.update({c:2, $and: [{c: 1}, {d: 1}]} , {$setOnInsert: {_id: 1}} , true);
-assert.gleError(db, "");
diff --git a/jstests/use_power_of_2.js b/jstests/use_power_of_2.js
deleted file mode 100644
index 3200c937452..00000000000
--- a/jstests/use_power_of_2.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* This test ensures that the usePowerOf2 user flag
- * effectively reuses space. The test repeatedly inserts and
- * then deletes a batch of variable-length strings, then checks
- * that doing so does not cause the storageSize to grow. */
-
-// A bunch of strings of length 0 to 100
-var var_length_strings =
- [ "" ,
- "aaaaa" ,
- "aaaaaaaaaa" ,
- "aaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ]
-
-//insert all the strings
-var batch_insert = function(coll){
- for ( i=0; i < var_length_strings.length; i++ ){
- coll.insert( { a : var_length_strings[i] } );
- }
-}
-
-//delete the same strings
-var batch_delete = function(coll){
- for ( i=0; i < var_length_strings.length; i++ ){
- coll.remove( { a : var_length_strings[i] } );
- }
-}
-
-//number of times to repeat batch inserts/deletes
-var numrepeats = 1000;
-
-var testStorageSize = function(ns){
- //insert docs and measure storage size
- batch_insert(ns);
- var oldSize = ns.stats().storageSize;
-
- //remove and add same docs a bunch of times
- for ( n=0 ; n < numrepeats ; n++ ){
- batch_delete(ns);
- batch_insert(ns);
- }
-
- //check size didn't change
- var newSize = ns.stats().storageSize;
- assert.eq( oldSize , newSize , "storage size changed");
-}
-
-/****************** TEST 1 *****************************/
-
-//create fresh collection, set flag to true, test storage size
-var coll = "usepower1"
-var t = db.getCollection(coll);
-t.drop();
-db.createCollection(coll);
-var res = db.runCommand( { "collMod" : coll , "usePowerOf2Sizes" : true } );
-assert.eq( res.ok , 1 , "collMod failed" );
-
-res = db.runCommand( { "collMod" : coll , "usePowerOf2Sizess" : true } )
-assert.eq( res.ok , 0 , "collMod should have failed: " + tojson( res ) )
-
-testStorageSize(t);
-
-/**************** Test 2 *****************************/
-
-//repeat previous test, but with flag set at creation time
-var coll = "usepower2"
-var t = db.getCollection(coll);
-t.drop();
-db.runCommand({"create" : coll, "flags" : 1 });
-
-testStorageSize(t);
diff --git a/jstests/verify_update_mods.js b/jstests/verify_update_mods.js
deleted file mode 100644
index b31130ec6eb..00000000000
--- a/jstests/verify_update_mods.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// Verify update mods exist
-t = db.update_mods;
-t.drop();
-
-t.save({_id:1});
-t.update({}, {$set:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$unset:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$inc:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$mul:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$push:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$pushAll:{a:[1]}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$addToSet:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$pull:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$pop:{a:true}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$rename:{a:"b"}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$bit:{a:{and:NumberLong(1)}}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-// SERVER-3223 test $bit can do an upsert
-t.update({_id:1}, {$bit:{a:{and:NumberLong(3)}}}, true);
-assert.eq(t.findOne({_id:1}).a, NumberLong(0), "$bit upsert with and");
-t.update({_id:2}, {$bit:{b:{or:NumberLong(3)}}}, true);
-assert.eq(t.findOne({_id:2}).b, NumberLong(3), "$bit upsert with or (long)");
-t.update({_id:3}, {$bit:{"c.d":{or:NumberInt(3)}}}, true);
-assert.eq(t.findOne({_id:3}).c.d, NumberInt(3), "$bit upsert with or (int)");
-t.remove({});
-
-t.save({_id:1});
-t.update({}, {$currentDate:{a:true}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$max:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})
-
-t.save({_id:1});
-t.update({}, {$min:{a:1}})
-assert.automsg( "!db.getLastError()" );
-t.remove({})