├── debian ├── compat ├── dirs ├── files ├── watch ├── copyright └── mongodb.upstart ├── jstests ├── indexbindata.js ├── dur │ ├── data │ │ └── empty.bson │ └── indexbg.js ├── libs │ ├── key2 │ ├── key1 │ ├── mockuser.keytab │ ├── mockservice.keytab │ ├── testconfig │ ├── authTestsKey │ ├── mockkrb5.conf │ ├── crl.pem │ └── crl_expired.pem ├── tool │ └── data │ │ ├── a.tsv │ │ ├── dumprestore6 │ │ ├── foo.bson │ │ └── system.indexes.bson │ │ └── csvimport1.csv ├── sharding │ ├── sharding_with_keyfile.key │ ├── addshard3.js │ ├── sync3.js │ ├── sync4.js │ └── hash_single_shard.js ├── _fail.js ├── js7.js ├── eval7.js ├── basicb.js ├── basic5.js ├── error4.js ├── basic6.js ├── objid2.js ├── update_invalid1.js ├── error3.js ├── _lodeRunner.js ├── insert2.js ├── error5.js ├── objid3.js ├── ssl │ └── replset1.js ├── find_and_modify_server6226.js ├── fm2.js ├── basic8.js ├── evale.js ├── find_and_modify_server6659.js ├── set1.js ├── find7.js ├── indexd.js ├── repair.js ├── in7.js ├── auth2.js ├── sub1.js ├── array3.js ├── basic7.js ├── find_and_modify_server6993.js ├── updateb.js ├── find3.js ├── evala.js ├── aggregation │ ├── bugs │ │ ├── server6198.js │ │ ├── server6530.js │ │ ├── server6194.js │ │ ├── server6335.js │ │ ├── server7900.js │ │ ├── server6181.js │ │ ├── server5973.js │ │ ├── server6185.js │ │ ├── server4738.js │ │ ├── server6275.js │ │ ├── server6468.js │ │ ├── server6232.js │ │ ├── server7768.js │ │ ├── server6779.js │ │ └── server6238.js │ ├── extras │ │ └── debug.html │ └── disabled │ │ └── server5369.js ├── index6.js ├── remove4.js ├── eval6.js ├── geo_s2nopoints.js ├── perf │ ├── geo_near1.js │ └── index1.js ├── dbref1.js ├── capped1.js ├── find_and_modify_where.js ├── fm1.js ├── in6.js ├── distinct2.js ├── find_and_modify_server6254.js ├── ne1.js ├── index3.js ├── update_addToSet2.js ├── update_blank1.js ├── extent.js ├── geo8.js ├── where2.js ├── autoid.js ├── js5.js ├── capped_server7543.js ├── ore.js ├── dbref2.js ├── update_multi6.js ├── basic4.js ├── eval0.js ├── indexf.js ├── update8.js ├── regexb.js ├── remove_justone.js ├── string_with_nul_bytes.js ├── filemd5.js ├── geo_near_random1.js ├── geonear_validate.js ├── updatej.js ├── array1.js ├── js1.js ├── auth │ ├── disable_localhost_bypass.js │ └── readProfile.js ├── geo4.js ├── geoa.js ├── indexg.js ├── pull_remove1.js ├── orl.js ├── ref2.js ├── update_multi5.js ├── date2.js ├── slowNightly │ ├── geo_near_random1.js │ ├── huge_multikey_index.js │ ├── newcollection2.js │ ├── remove9.js │ ├── explain2.js │ ├── server7428.js │ └── recstore.js ├── basic2.js ├── set3.js ├── eval8.js ├── counta.js ├── dbcase2.js ├── temp_cleanup.js ├── in3.js ├── set_param1.js ├── date1.js ├── find2.js ├── find_and_modify_server7660.js ├── where3.js ├── array_match3.js ├── rename2.js ├── db.js ├── remove3.js ├── bad_index_plugin.js ├── count4.js ├── error2.js ├── objid1.js ├── objid7.js ├── eval_nolock.js ├── index_check7.js ├── misc │ └── biginsert.js ├── indexi.js ├── set4.js ├── set5.js ├── update_arraymatch6.js ├── eval1.js ├── geo_s2selfintersectingpoly.js ├── maxscan.js ├── regex9.js ├── updatec.js ├── auth_copydb.js ├── push2.js ├── repl │ ├── repair.js │ └── block1.js ├── indexw.js ├── objid4.js ├── remove8.js ├── skip1.js ├── ork.js ├── update_multi4.js ├── indexv.js ├── eval4.js ├── update_arraymatch1.js ├── sortj.js ├── type2.js ├── capped.js ├── upsert1.js ├── cursor1.js ├── org.js ├── update2.js ├── where1.js ├── update_arraymatch3.js ├── exists2.js ├── queryoptimizer6.js ├── arrayfind3.js ├── inc3.js ├── regexa.js ├── update_arraymatch4.js ├── auth_copydb2.js ├── geo_poly_line.js ├── geof.js ├── server9385.js ├── countb.js ├── geo_box2.js ├── geod.js ├── ne3.js ├── geo_withinquery.js ├── objid6.js ├── orh.js ├── basic1.js ├── find_and_modify_server6582.js ├── geo7.js ├── ismaster.js ├── geo_regex0.js ├── indexz.js ├── geo_distinct.js ├── set2.js ├── update9.js ├── basic9.js ├── fts_partition_no_multikey.js ├── parallel │ ├── checkMultiThread.js │ └── basic.js ├── updated.js ├── geo_sort1.js ├── ref.js ├── set6.js ├── geo5.js ├── geo_s2dedupnear.js ├── ref3.js ├── distinct_speed1.js ├── find_and_modify2.js ├── exists7.js ├── sortf.js ├── update_multi3.js ├── fm4.js ├── orb.js ├── regex8.js ├── slowWeekly │ └── geo_near_random1.js ├── queryoptimizerc.js ├── datasize2.js ├── objid5.js ├── disk │ ├── newcollection1.js │ └── dbNoCreate.js ├── geo_multikey1.js ├── shellstartparallel.js ├── eval5.js ├── remove9.js ├── js9.js ├── regex_util.js ├── count7.js ├── inc2.js ├── index5.js ├── indexa.js ├── pullall2.js ├── dropdb.js ├── inb.js ├── mr_undef.js ├── not1.js ├── numberlong4.js ├── explain3.js ├── server1470.js ├── basicc.js ├── capped_empty.js ├── covered_index_sort_2.js ├── geo_s2nearcorrect.js ├── remove.js ├── update_arraymatch2.js ├── fsync.js ├── gle_shell_server5441.js ├── eval3.js └── indexq.js ├── src ├── third_party │ ├── v8 │ │ ├── tools │ │ │ ├── android-build.sh │ │ │ ├── mac-tick-processor │ │ │ └── freebsd-tick-processor │ │ └── ChangeLog_10gen │ ├── js-1.7 │ │ ├── config │ │ │ └── CVS │ │ │ │ ├── Tag │ │ │ │ ├── Repository │ │ │ │ └── Root │ │ ├── fdlibm │ │ │ ├── CVS │ │ │ │ ├── Tag │ │ │ │ ├── Repository │ │ │ │ └── Root │ │ │ ├── .cvsignore │ │ │ └── fdlibm.mdp │ │ ├── js.pkg │ │ ├── js.mdp │ │ ├── Y.js │ │ └── resource.h │ ├── pcre-8.30 │ │ ├── stamp-h1 │ │ ├── ChangeLog │ │ ├── COPYING │ │ ├── libpcrecpp.pc │ │ ├── libpcrecpp.pc.in │ │ ├── libpcre.pc │ │ ├── libpcre16.pc │ │ ├── libpcreposix.pc │ │ ├── libpcre.pc.in │ │ ├── libpcre16.pc.in │ │ ├── libpcreposix.pc.in │ │ └── makevp_c.txt │ ├── murmurhash3 │ │ └── SConscript │ ├── boost │ │ ├── boost │ │ │ ├── utility │ │ │ │ └── declval.hpp │ │ │ ├── smart_ptr │ │ │ │ └── detail │ │ │ │ │ └── atomic_count_gcc.hpp │ │ │ ├── functional │ │ │ │ ├── hash.hpp │ │ │ │ └── hash_fwd.hpp │ │ │ ├── concept │ │ │ │ └── detail │ │ │ │ │ └── concept_undef.hpp │ │ │ ├── config │ │ │ │ ├── abi │ │ │ │ │ ├── msvc_suffix.hpp │ │ │ │ │ └── borland_suffix.hpp │ │ │ │ └── platform │ │ │ │ │ ├── amigaos.hpp │ │ │ │ │ └── cray.hpp │ │ │ ├── typeof │ │ │ │ └── message.hpp │ │ │ ├── swap.hpp │ │ │ ├── mpl │ │ │ │ └── aux_ │ │ │ │ │ └── preprocessed │ │ │ │ │ ├── bcc551 │ │ │ │ │ └── quote.hpp │ │ │ │ │ ├── msvc60 │ │ │ │ │ └── quote.hpp │ │ │ │ │ ├── no_ttp │ │ │ │ │ └── quote.hpp │ │ │ │ │ ├── bcc_pre590 │ │ │ │ │ └── quote.hpp │ │ │ │ │ ├── dmc │ │ │ │ │ └── template_arity.hpp │ │ │ │ │ ├── mwcw │ │ │ │ │ └── template_arity.hpp │ │ │ │ │ └── plain │ │ │ │ │ └── template_arity.hpp │ │ │ ├── exception_ptr.hpp │ │ │ ├── thread │ │ │ │ └── condition.hpp │ │ │ ├── function │ │ │ │ ├── function0.hpp │ │ │ │ ├── function1.hpp │ │ │ │ ├── function10.hpp │ │ │ │ ├── function2.hpp │ │ │ │ ├── function3.hpp │ │ │ │ ├── function4.hpp │ │ │ │ ├── function5.hpp │ │ │ │ ├── function6.hpp │ │ │ │ ├── function7.hpp │ │ │ │ ├── function8.hpp │ │ │ │ └── function9.hpp │ │ │ ├── type.hpp │ │ │ ├── weak_ptr.hpp │ │ │ ├── make_shared.hpp │ │ │ ├── scoped_ptr.hpp │ │ │ ├── scoped_array.hpp │ │ │ ├── intrusive_ptr.hpp │ │ │ └── type_traits │ │ │ │ ├── aligned_storage.hpp │ │ │ │ └── detail │ │ │ │ └── size_t_trait_undef.hpp │ │ └── libs │ │ │ └── filesystem │ │ │ ├── v3 │ │ │ ├── doc │ │ │ │ ├── faq.htm │ │ │ │ ├── v3.html │ │ │ │ ├── design.htm │ │ │ │ ├── do_list.html │ │ │ │ ├── reference.html │ │ │ │ ├── src │ │ │ │ │ ├── source.html │ │ │ │ │ ├── tr2_snippets.html │ │ │ │ │ ├── boost_snippets.html │ │ │ │ │ ├── build.bat │ │ │ │ │ └── README │ │ │ │ ├── tutorial.html │ │ │ │ ├── release_history.html │ │ │ │ └── portability_guide.htm │ │ │ ├── example │ │ │ │ └── test │ │ │ │ │ ├── bld.bat │ │ │ │ │ ├── bld.sh │ │ │ │ │ ├── setup.bat │ │ │ │ │ └── setup.sh │ │ │ └── index.html │ │ │ └── v2 │ │ │ ├── doc │ │ │ ├── design.htm │ │ │ ├── i18n.html │ │ │ └── portability_guide.htm │ │ │ ├── test │ │ │ └── msvc │ │ │ │ └── common.vsprops │ │ │ └── example │ │ │ └── Jamfile.v2 │ ├── gperftools-2.0 │ │ └── src │ │ │ ├── windows │ │ │ ├── ia32_modrm_map.cc │ │ │ ├── ia32_opcode_map.cc │ │ │ └── mini_disassembler.h │ │ │ └── config.h │ ├── shim_v8.cpp │ ├── shim_boost.cpp │ ├── shim_snappy.cpp │ ├── shim_pcrecpp.cc │ ├── shim_allocator.cpp │ ├── shim_spidermonkey.cpp │ ├── s2 │ │ ├── s2region.cc │ │ ├── strings │ │ │ └── SConscript │ │ ├── base │ │ │ ├── SConscript │ │ │ ├── definer.h │ │ │ └── int128.cc │ │ └── util │ │ │ ├── coding │ │ │ └── SConscript │ │ │ └── math │ │ │ └── SConscript │ ├── snappy │ │ └── SConscript │ └── libstemmer_c │ │ ├── Makefile │ │ └── src_c │ │ ├── stem_UTF_8_dutch.h │ │ ├── stem_UTF_8_danish.h │ │ ├── stem_UTF_8_french.h │ │ ├── stem_UTF_8_german.h │ │ ├── stem_UTF_8_porter.h │ │ ├── stem_KOI8_R_russian.h │ │ ├── stem_UTF_8_english.h │ │ ├── stem_UTF_8_finnish.h │ │ ├── stem_UTF_8_italian.h │ │ ├── stem_UTF_8_romanian.h │ │ ├── stem_UTF_8_russian.h │ │ ├── stem_UTF_8_spanish.h │ │ ├── stem_UTF_8_swedish.h │ │ ├── stem_UTF_8_turkish.h │ │ ├── stem_UTF_8_hungarian.h │ │ ├── stem_UTF_8_norwegian.h │ │ ├── stem_ISO_8859_1_dutch.h │ │ ├── stem_UTF_8_portuguese.h │ │ ├── stem_ISO_8859_1_danish.h │ │ ├── stem_ISO_8859_1_french.h │ │ ├── stem_ISO_8859_1_german.h │ │ ├── stem_ISO_8859_1_porter.h │ │ ├── stem_ISO_8859_1_english.h │ │ ├── stem_ISO_8859_1_finnish.h │ │ ├── stem_ISO_8859_1_italian.h │ │ ├── stem_ISO_8859_1_spanish.h │ │ ├── stem_ISO_8859_1_swedish.h │ │ ├── stem_ISO_8859_2_romanian.h │ │ ├── stem_ISO_8859_1_hungarian.h │ │ ├── stem_ISO_8859_1_norwegian.h │ │ └── stem_ISO_8859_1_portuguese.h ├── mongo │ ├── db │ │ ├── mongo.ico │ │ ├── repl │ │ │ └── test.html │ │ ├── db.rc │ │ ├── kdtree │ │ │ ├── Trip.hpp │ │ │ └── DBHandler.hpp │ │ └── SConscript │ ├── shell │ │ └── mongo.ico │ ├── bson │ │ └── README │ ├── platform │ │ └── SConscript │ ├── util │ │ ├── mongoutils │ │ │ └── mongoutils.vcxproj.filters │ │ └── lame_stacktrace_test.cpp │ └── unittest │ │ └── SConscript └── SConscript ├── rpm └── mongod.sysconfig ├── .gitattributes ├── docs ├── index.md └── building.opensolaris.ec2.md ├── mongo_astyle ├── valgrind.suppressions ├── win2008plus.props └── standalone ├── Trip.hpp └── timing.hpp /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /jstests/indexbindata.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jstests/dur/data/empty.bson: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jstests/libs/key2: -------------------------------------------------------------------------------- 1 | other key 2 | -------------------------------------------------------------------------------- /jstests/libs/key1: -------------------------------------------------------------------------------- 1 | foop de doop 2 | -------------------------------------------------------------------------------- /src/third_party/v8/tools/android-build.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/config/CVS/Tag: -------------------------------------------------------------------------------- 1 | NJS_170 2 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/fdlibm/CVS/Tag: -------------------------------------------------------------------------------- 1 | NJS_170 2 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/sbin 3 | var/lib/mongodb 4 | -------------------------------------------------------------------------------- /debian/files: -------------------------------------------------------------------------------- 1 | mongodb_0.9.7_amd64.deb devel optional 2 | -------------------------------------------------------------------------------- /jstests/tool/data/a.tsv: -------------------------------------------------------------------------------- 1 | a b c d e 2 | 1 foobar 5 -6 3 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config.h 2 | -------------------------------------------------------------------------------- /jstests/sharding/sharding_with_keyfile.key: -------------------------------------------------------------------------------- 1 | aBcDeFg 2 | 1010101 3 | JJJJJJJ -------------------------------------------------------------------------------- /rpm/mongod.sysconfig: -------------------------------------------------------------------------------- 1 | # TODO: add relevant configuration stuff here. 2 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/config/CVS/Repository: -------------------------------------------------------------------------------- 1 | mozilla/js/src/config 2 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/fdlibm/CVS/Repository: -------------------------------------------------------------------------------- 1 | mozilla/js/src/fdlibm 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.vcproj -crlf -diff -merge 2 | *.pbxproj -crlf -diff -merge 3 | 4 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/js.pkg: -------------------------------------------------------------------------------- 1 | [gecko xpi-bootstrap] 2 | dist/bin/@SHARED_LIBRARY@ 3 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/config/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot 2 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/fdlibm/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot 2 | -------------------------------------------------------------------------------- /src/mongo/db/mongo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/mongo/db/mongo.ico -------------------------------------------------------------------------------- /src/mongo/shell/mongo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/mongo/shell/mongo.ico -------------------------------------------------------------------------------- /jstests/libs/mockuser.keytab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/jstests/libs/mockuser.keytab -------------------------------------------------------------------------------- /src/third_party/js-1.7/js.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/js-1.7/js.mdp -------------------------------------------------------------------------------- /jstests/_fail.js: -------------------------------------------------------------------------------- 1 | // For testing the test runner. 2 | assert.eq(1, 2, "fail1") 3 | 4 | print("you should not see this") -------------------------------------------------------------------------------- /jstests/libs/mockservice.keytab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/jstests/libs/mockservice.keytab -------------------------------------------------------------------------------- /jstests/libs/testconfig: -------------------------------------------------------------------------------- 1 | fastsync = true 2 | #comment line 3 | #commentedflagwithan = false 4 | version = false 5 | -------------------------------------------------------------------------------- /src/third_party/js-1.7/fdlibm/.cvsignore: -------------------------------------------------------------------------------- 1 | *.pdb 2 | *.ncb 3 | *.opt 4 | *.plg 5 | Debug 6 | Release 7 | Makefile 8 | -------------------------------------------------------------------------------- /src/third_party/murmurhash3/SConscript: -------------------------------------------------------------------------------- 1 | Import("env") 2 | env.StaticLibrary("murmurhash3", ["MurmurHash3.cpp"]) 3 | -------------------------------------------------------------------------------- /jstests/libs/authTestsKey: -------------------------------------------------------------------------------- 1 | This key is only for running the suite with authentication dont use it in any tests directly 2 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/pcre-8.30/ChangeLog -------------------------------------------------------------------------------- /jstests/js7.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_js7; 2 | t.drop(); 3 | 4 | assert.eq( 17 , db.eval( function( foo ){ return foo; } , 17 ) ); 5 | 6 | -------------------------------------------------------------------------------- /jstests/tool/data/dumprestore6/foo.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/jstests/tool/data/dumprestore6/foo.bson -------------------------------------------------------------------------------- /src/third_party/js-1.7/fdlibm/fdlibm.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/js-1.7/fdlibm/fdlibm.mdp -------------------------------------------------------------------------------- /jstests/eval7.js: -------------------------------------------------------------------------------- 1 | 2 | assert.eq( 6 , db.eval( "5 + 1" ) , "A" ) 3 | assert.throws( function(z){ db.eval( "5 + function x; + 1" )} ); 4 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/utility/declval.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/boost/utility/declval.hpp -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/COPYING: -------------------------------------------------------------------------------- 1 | PCRE LICENCE 2 | 3 | Please see the file LICENCE in the PCRE distribution for licensing details. 4 | 5 | End 6 | -------------------------------------------------------------------------------- /jstests/tool/data/dumprestore6/system.indexes.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/jstests/tool/data/dumprestore6/system.indexes.bson -------------------------------------------------------------------------------- /jstests/basicb.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.basicb; 3 | t.drop(); 4 | 5 | assert.throws( "t.insert( { '$a' : 5 } );" ); 6 | t.insert( { '$a' : 5 } , 0, true ); 7 | 8 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/faq.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/faq.htm -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/v3.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/v3.html -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v2/doc/design.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v2/doc/design.htm -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v2/doc/i18n.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v2/doc/i18n.html -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/design.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/design.htm -------------------------------------------------------------------------------- /jstests/basic5.js: -------------------------------------------------------------------------------- 1 | t = db.getCollection( "basic5" ); 2 | t.drop(); 3 | 4 | t.save( { a : 1 , b : [ 1 , 2 , 3 ] } ); 5 | assert.eq( 3 , t.findOne().b.length ); 6 | 7 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/do_list.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/do_list.html -------------------------------------------------------------------------------- /jstests/error4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.error4; 3 | t.drop() 4 | t.insert( { _id : 1 } ) 5 | t.insert( { _id : 1 } ) 6 | assert.eq( 11000 , db.getLastErrorCmd().code , "A" ) 7 | 8 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/reference.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/reference.html -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/src/source.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/src/source.html -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/tutorial.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/tutorial.html -------------------------------------------------------------------------------- /src/third_party/gperftools-2.0/src/windows/ia32_modrm_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/gperftools-2.0/src/windows/ia32_modrm_map.cc -------------------------------------------------------------------------------- /src/third_party/gperftools-2.0/src/windows/ia32_opcode_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/gperftools-2.0/src/windows/ia32_opcode_map.cc -------------------------------------------------------------------------------- /src/third_party/gperftools-2.0/src/windows/mini_disassembler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/gperftools-2.0/src/windows/mini_disassembler.h -------------------------------------------------------------------------------- /src/third_party/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/release_history.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/release_history.html -------------------------------------------------------------------------------- /jstests/basic6.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.basic6; 3 | 4 | t.findOne(); 5 | t.a.findOne(); 6 | 7 | assert.eq( "test.basic6" , t.toString() ); 8 | assert.eq( "test.basic6.a" , t.a.toString() ); 9 | -------------------------------------------------------------------------------- /jstests/objid2.js: -------------------------------------------------------------------------------- 1 | t = db.objid2; 2 | t.drop(); 3 | 4 | t.save( { _id : 517 , a : "hello" } ) 5 | 6 | assert.eq( t.findOne().a , "hello" ); 7 | assert.eq( t.findOne()._id , 517 ); 8 | -------------------------------------------------------------------------------- /jstests/update_invalid1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_invalid1 3 | t.drop() 4 | 5 | t.update( { _id : 5 } , { $set : { $inc : { x : 5 } } } , true ); 6 | assert.eq( 0 , t.count() , "A1" ); 7 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v2/doc/portability_guide.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v2/doc/portability_guide.htm -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/portability_guide.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/portability_guide.htm -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/src/tr2_snippets.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/src/tr2_snippets.html -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/src/boost_snippets.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harishd10/mongodb/HEAD/src/third_party/boost/libs/filesystem/v3/doc/src/boost_snippets.html -------------------------------------------------------------------------------- /jstests/error3.js: -------------------------------------------------------------------------------- 1 | 2 | db.runCommand( "forceerror" ); 3 | assert.eq( "forced error" , db.getLastError() ); 4 | db.runCommand( "switchtoclienterrors" ); 5 | assert.isnull( db.getLastError() ); 6 | -------------------------------------------------------------------------------- /src/third_party/shim_v8.cpp: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_v8.cpp is part of the 2 | // third_party/v8 library, which is just a placeholder for forwarding 3 | // library dependencies. 4 | -------------------------------------------------------------------------------- /jstests/_lodeRunner.js: -------------------------------------------------------------------------------- 1 | // Start mongod and run jstests/_runner.js 2 | 3 | db = startMongod( "--port", "27018", "--dbpath", "/data/db/jstests" ).getDB( "test" ); 4 | load( "jstests/_runner.js" ); 5 | -------------------------------------------------------------------------------- /jstests/insert2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.insert2 3 | t.drop() 4 | 5 | assert.isnull( t.findOne() , "A" ) 6 | t.insert( { z : 1 , $inc : { x : 1 } } , 0, true ); 7 | assert.isnull( t.findOne() , "B" ) 8 | 9 | -------------------------------------------------------------------------------- /src/third_party/shim_boost.cpp: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_boost.cpp is part of the 2 | // third_party/boost library, which is just a placeholder for forwarding 3 | // library dependencies. 4 | -------------------------------------------------------------------------------- /src/third_party/shim_snappy.cpp: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_snappy.cpp is part of the 2 | // third_party/snappy library, which is just a placeholder for forwarding 3 | // library dependencies. 4 | -------------------------------------------------------------------------------- /jstests/error5.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.error5 3 | t.drop(); 4 | 5 | assert.throws( function(){ t.save( 4 ); printjson( t.findOne() ) } , null , "A" ); 6 | t.save( { a : 1 } ) 7 | assert.eq( 1 , t.count() , "B" ); 8 | 9 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/src/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | del tr2.html >nul 3 | mmp TARGET=TR2 source.html tr2.html 4 | del reference.html >nul 5 | mmp TARGET=BOOST source.html reference.html 6 | -------------------------------------------------------------------------------- /src/third_party/shim_pcrecpp.cc: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_pcrecpp.cc is part of the 2 | // third_party/pcrecpp library, which is just a placeholder for forwarding 3 | // library dependencies. 4 | -------------------------------------------------------------------------------- /src/third_party/shim_allocator.cpp: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_allocator.cpp is part of the third_party/shim_allocator 2 | // library, used to manage memory allocator selection (tcmalloc, libc, etc.). 3 | -------------------------------------------------------------------------------- /jstests/objid3.js: -------------------------------------------------------------------------------- 1 | t = db.objid3; 2 | t.drop(); 3 | 4 | t.save( { a : "bob" , _id : 517 } ); 5 | for ( var k in t.findOne() ){ 6 | assert.eq( k , "_id" , "keys out of order" ); 7 | break; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /jstests/ssl/replset1.js: -------------------------------------------------------------------------------- 1 | ssl_options = {sslOnNormalPorts : "", 2 | sslPEMKeyFile : "jstests/libs/server.pem", 3 | sslCAFile: "jstests/libs/ca.pem"}; 4 | 5 | load("jstests/replsets/replset1.js"); -------------------------------------------------------------------------------- /jstests/find_and_modify_server6226.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.find_and_modify_server6226; 3 | t.drop(); 4 | 5 | ret = t.findAndModify( { query : { _id : 1 } , update : { "$inc" : { i : 1 } } , upsert : true } ) 6 | assert.isnull( ret ) 7 | 8 | -------------------------------------------------------------------------------- /jstests/fm2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.fm2 3 | t.drop(); 4 | 5 | t.insert( { "one" : { "two" : {"three":"four"} } } ); 6 | 7 | x = t.find({},{"one.two":1})[0] 8 | assert.eq( 1 , Object.keySet( x.one ).length , "ks l 1" ); 9 | 10 | -------------------------------------------------------------------------------- /src/third_party/shim_spidermonkey.cpp: -------------------------------------------------------------------------------- 1 | // This file intentionally blank. shim_spidermonkey.cpp is part of the 2 | // third_party/mongo_spidermonkey library, which is just a placeholder for forwarding 3 | // library dependencies. 4 | -------------------------------------------------------------------------------- /jstests/basic8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.basic8; 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ); 6 | o = t.findOne(); 7 | o.b = 2; 8 | t.save( o ); 9 | 10 | assert.eq( 1 , t.find().count() , "A" ); 11 | assert.eq( 2 , t.findOne().b , "B" ); 12 | -------------------------------------------------------------------------------- /jstests/evale.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_evale; 2 | t.drop(); 3 | 4 | db.eval( function() { return db.jstests_evale.count( { $where:function() { return true; } } ) } ); 5 | db.eval( "db.jstests_evale.count( { $where:function() { return true; } } )" ); -------------------------------------------------------------------------------- /jstests/find_and_modify_server6659.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.find_and_modify_server6659; 3 | t.drop(); 4 | 5 | x = t.findAndModify({query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true}) 6 | assert.eq( 2, x.f ); 7 | assert.eq( 2, t.findOne().f ); 8 | -------------------------------------------------------------------------------- /jstests/set1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set1; 3 | t.drop(); 4 | 5 | t.insert( { _id : 1, emb : {} }); 6 | t.update( { _id : 1 }, { $set : { emb : { 'a.dot' : 'data'} }}); 7 | assert.eq( { _id : 1 , emb : {} } , t.findOne() , "A" ); 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | 2 | MongoDB Server Documentation 3 | ============ 4 | 5 | This is just some internal documentation. 6 | 7 | For the full MongoDB docs, please see [mongodb.org](http://www.mongodb.org/) 8 | 9 | * [building](building.html) 10 | -------------------------------------------------------------------------------- /jstests/find7.js: -------------------------------------------------------------------------------- 1 | t = db.find7; 2 | t.drop(); 3 | 4 | x = { "_id" : { "d" : 3649, "w" : "signed" }, "u" : { "3649" : 5 } }; 5 | t.insert(x ); 6 | assert.eq( x , t.findOne() , "A1" ); 7 | assert.eq( x , t.findOne( { _id : x._id } ) , "A2" ); 8 | 9 | -------------------------------------------------------------------------------- /jstests/indexd.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.indexd; 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ); 6 | t.ensureIndex( { a : 1 } ); 7 | assert.throws( function(){ db.indexd.$_id_.drop(); } ); 8 | assert( t.drop() ); 9 | 10 | //db.indexd.$_id_.remove({}); 11 | -------------------------------------------------------------------------------- /jstests/repair.js: -------------------------------------------------------------------------------- 1 | mydb = db.getSisterDB( "repair_test1" ) 2 | t = mydb.jstests_repair; 3 | t.drop(); 4 | t.save( { i:1 } ); 5 | assert.commandWorked( mydb.repairDatabase() ); 6 | v = t.validate(); 7 | assert( v.valid , "not valid! " + tojson( v ) ); 8 | -------------------------------------------------------------------------------- /jstests/in7.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_slow_in1; 2 | 3 | t.drop(); 4 | t.ensureIndex( {a:1,b:1,c:1,d:1,e:1,f:1,g:1} ); 5 | i = {$in:[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]}; 6 | assert.throws.automsg( function() { t.count( {a:i,b:i,c:i,d:i,e:i,f:i,g:i} ); } ); 7 | -------------------------------------------------------------------------------- /jstests/auth2.js: -------------------------------------------------------------------------------- 1 | // just make sure logout doesn't break anything 2 | 3 | // SERVER-724 4 | db.runCommand({logout : 1}); 5 | x = db.runCommand({logout : 1}); 6 | assert.eq( 1 , x.ok , "A" ) 7 | 8 | x = db.logout(); 9 | assert.eq( 1 , x.ok , "B" ) 10 | -------------------------------------------------------------------------------- /jstests/sharding/addshard3.js: -------------------------------------------------------------------------------- 1 | 2 | s = new ShardingTest( "add_shard3", 1 ); 3 | 4 | var result = s.admin.runCommand({"addshard" : "localhost:31000"}); 5 | 6 | printjson(result); 7 | 8 | assert.eq(result.ok, 0, "don't add mongos as a shard"); 9 | 10 | -------------------------------------------------------------------------------- /jstests/sub1.js: -------------------------------------------------------------------------------- 1 | // sub1.js 2 | 3 | t = db.sub1; 4 | t.drop(); 5 | 6 | x = { a : 1 , b : { c : { d : 2 } } } 7 | 8 | t.save( x ); 9 | 10 | y = t.findOne(); 11 | 12 | assert.eq( 1 , y.a ); 13 | assert.eq( 2 , y.b.c.d ); 14 | print( tojson( y ) ); 15 | -------------------------------------------------------------------------------- /src/third_party/v8/tools/mac-tick-processor: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # A wrapper script to call 'linux-tick-processor' with Mac-specific settings. 4 | 5 | tools_path=`cd $(dirname "$0");pwd` 6 | $tools_path/linux-tick-processor --mac --nm=$tools_path/mac-nm $@ 7 | -------------------------------------------------------------------------------- /jstests/array3.js: -------------------------------------------------------------------------------- 1 | 2 | assert.eq( 5 , Array.sum( [ 1 , 4 ] ), "A" ) 3 | assert.eq( 2.5 , Array.avg( [ 1 , 4 ] ), "B" ) 4 | 5 | arr = [ 2 , 4 , 4 , 4 , 5 , 5 , 7 , 9 ] 6 | assert.eq( 5 , Array.avg( arr ) , "C" ) 7 | assert.eq( 2 , Array.stdDev( arr ) , "D" ) 8 | 9 | -------------------------------------------------------------------------------- /jstests/basic7.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.basic7; 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ) 6 | t.ensureIndex( { a : 1 } ); 7 | 8 | assert.eq( t.find().toArray()[0].a , 1 ); 9 | assert.eq( t.find().arrayAccess(0).a , 1 ); 10 | assert.eq( t.find()[0].a , 1 ); 11 | 12 | -------------------------------------------------------------------------------- /jstests/find_and_modify_server6993.js: -------------------------------------------------------------------------------- 1 | 2 | c = db.find_and_modify_server6993; 3 | c.drop(); 4 | 5 | c.insert( { a:[ 1, 2 ] } ); 6 | 7 | c.findAndModify( { query:{ a:1 }, update:{ $set:{ 'a.$':5 } } } ); 8 | 9 | assert.eq( 5, c.findOne().a[ 0 ] ); 10 | -------------------------------------------------------------------------------- /jstests/updateb.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.updateb; 3 | t.drop(); 4 | 5 | t.update( { "x.y" : 2 } , { $inc : { a : 7 } } , true ); 6 | 7 | correct = { a : 7 , x : { y : 2 } }; 8 | got = t.findOne(); 9 | delete got._id; 10 | assert.eq( correct , got , "A" ) 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/gperftools-2.0/src/config.h: -------------------------------------------------------------------------------- 1 | #if defined(__linux__) 2 | #include "config-10gen-linux.h" 3 | #elif defined(__APPLE__) 4 | #include "config-10gen-macos.h" 5 | #else 6 | #error "In tree version of TCMalloc not supported on this platform!" 7 | #endif 8 | -------------------------------------------------------------------------------- /jstests/find3.js: -------------------------------------------------------------------------------- 1 | t = db.find3; 2 | t.drop(); 3 | 4 | for ( i=1; i<=50; i++) 5 | t.save( { a : i } ); 6 | 7 | assert.eq( 50 , t.find().toArray().length ); 8 | assert.eq( 20 , t.find().limit(20).toArray().length ); 9 | 10 | assert(t.validate().valid); 11 | -------------------------------------------------------------------------------- /src/third_party/s2/s2region.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005 Google Inc. All Rights Reserved. 2 | 3 | #include "s2region.h" 4 | 5 | S2Region::~S2Region() { 6 | } 7 | 8 | bool S2Region::DecodeWithinScope(Decoder* const decoder) { 9 | return Decode(decoder); 10 | } 11 | -------------------------------------------------------------------------------- /jstests/evala.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.evala; 3 | t.drop() 4 | 5 | t.save( { x : 5 } ) 6 | 7 | assert.eq( 5 , db.eval( "function(){ return db.evala.findOne().x; }" ) , "A" ); 8 | assert.eq( 5 , db.eval( "/* abc */function(){ return db.evala.findOne().x; }" ) , "B" ); 9 | 10 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/example/test/bld.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright Beman Dawes, 2010 3 | rem Distributed under the Boost Software License, Version 1.0. 4 | rem See www.boost.org/LICENSE_1_0.txt 5 | 6 | bjam %* >bjam.log 7 | find "error" bjam.log 8 | grep "error" JSON 5 | are available for most languages at bsonspec.org. 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/mongo/platform/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env") 4 | 5 | env.Library( "platform", "random.cpp" ) 6 | 7 | env.CppUnitTest('atomic_word_test', 'atomic_word_test.cpp') 8 | env.CppUnitTest('bits_test', 'bits_test.cpp') 9 | env.CppUnitTest('random_test', 'random_test.cpp') 10 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/functional/hash.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2005-2009 Daniel James. 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | 8 | -------------------------------------------------------------------------------- /jstests/distinct2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.distinct2; 3 | t.drop(); 4 | 5 | t.save({a:null}); 6 | assert.eq( 0 , t.distinct('a.b').length , "A" ); 7 | 8 | t.drop(); 9 | t.save( { a : 1 } ); 10 | assert.eq( [1] , t.distinct( "a" ) , "B" ); 11 | t.save( {} ) 12 | assert.eq( [1] , t.distinct( "a" ) , "C" ); 13 | 14 | -------------------------------------------------------------------------------- /jstests/find_and_modify_server6254.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.find_and_modify_server6254; 3 | t.drop(); 4 | 5 | t.insert( { x : 1 } ) 6 | ret = t.findAndModify( { query : { x : 1 } , update : { $set : { x : 2 } } , new : true } ) 7 | assert.eq( 2 , ret.x , tojson( ret ) ) 8 | 9 | assert.eq( 1 , t.count() ) 10 | 11 | -------------------------------------------------------------------------------- /jstests/ne1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.ne1; 3 | t.drop(); 4 | 5 | t.save( { x : 1 } ); 6 | t.save( { x : 2 } ); 7 | t.save( { x : 3 } ); 8 | 9 | assert.eq( 2 , t.find( { x : { $ne : 2 } } ).itcount() , "A" ); 10 | t.ensureIndex( { x : 1 } ); 11 | assert.eq( 2 , t.find( { x : { $ne : 2 } } ).itcount() , "B" ); 12 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/functional/hash_fwd.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2005-2009 Daniel James. 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #include 7 | 8 | -------------------------------------------------------------------------------- /jstests/index3.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | t = db.index3; 4 | t.drop(); 5 | 6 | assert( t.getIndexes().length == 0 ); 7 | 8 | t.ensureIndex( { name : 1 } ); 9 | 10 | t.save( { name : "a" } ); 11 | 12 | t.ensureIndex( { name : 1 } ); 13 | 14 | assert( t.getIndexes().length == 2 ); 15 | 16 | assert(t.validate().valid); 17 | -------------------------------------------------------------------------------- /jstests/update_addToSet2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_addToSet2 3 | t.drop(); 4 | 5 | o = { _id : 1 } 6 | t.insert( { _id : 1 } ); 7 | 8 | t.update({},{$addToSet : {'kids' :{ 'name' : 'Bob', 'age': '4'}}}) 9 | t.update({},{$addToSet : {'kids' :{ 'name' : 'Dan', 'age': '2'}}}) 10 | 11 | printjson( t.findOne() ); 12 | -------------------------------------------------------------------------------- /jstests/update_blank1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_blank1 3 | t.drop(); 4 | 5 | orig = { "" : 1 , _id : 2 , "a" : 3 , "b" : 4 }; 6 | t.insert( orig ); 7 | t.update( {} , { $set : { "c" : 5 } } ); 8 | print( db.getLastError() ); 9 | orig["c"] = 5; 10 | assert.eq( orig , t.findOne() , "after $set" ); // SERVER-2651 11 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/concept/detail/concept_undef.hpp: -------------------------------------------------------------------------------- 1 | // Copyright David Abrahams 2006. Distributed under the Boost 2 | // Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | # undef BOOST_concept_typename 5 | # undef BOOST_concept 6 | -------------------------------------------------------------------------------- /jstests/extent.js: -------------------------------------------------------------------------------- 1 | t = db.reclaimExtentsTest; 2 | t.drop(); 3 | 4 | for ( var i=0; i<50; i++ ) { // enough iterations to break 32 bit. 5 | db.createCollection('reclaimExtentsTest', { size : 100000000 }); 6 | t.insert({x:1}); 7 | assert( t.count() == 1 ); 8 | t.drop(); 9 | } 10 | t.drop(); 11 | 12 | -------------------------------------------------------------------------------- /jstests/geo8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.geo8 3 | t.drop() 4 | 5 | t.insert( { loc : [ 5 , 5 ] } ) 6 | t.insert( { loc : [ 5 , 6 ] } ) 7 | t.insert( { loc : [ 5 , 7 ] } ) 8 | t.insert( { loc : [ 4 , 5 ] } ) 9 | t.insert( { loc : [ 100 , 100 ] } ) 10 | 11 | t.ensureIndex( { loc : "2d" } ) 12 | 13 | t.runCommand( "geoWalk" ); 14 | -------------------------------------------------------------------------------- /jstests/libs/mockkrb5.conf: -------------------------------------------------------------------------------- 1 | [libdefaults] 2 | default_realm = 10GEN.ME 3 | 4 | [realms] 5 | 10GEN.ME = { 6 | kdc = kdc.10gen.me 7 | admin_server = kdc.10gen.me 8 | default_domain = 10gen.me 9 | } 10 | 11 | [domain_realm] 12 | .10gen.me = 10GEN.ME 13 | 10gen.me = 10GEN.ME 14 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/Makefile: -------------------------------------------------------------------------------- 1 | include mkinc.mak 2 | CFLAGS=-Iinclude 3 | all: libstemmer.o stemwords 4 | libstemmer.o: $(snowball_sources:.c=.o) 5 | $(AR) -cru $@ $^ 6 | stemwords: examples/stemwords.o libstemmer.o 7 | $(CC) -o $@ $^ 8 | clean: 9 | rm -f stemwords *.o src_c/*.o runtime/*.o libstemmer/*.o 10 | -------------------------------------------------------------------------------- /jstests/where2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.getCollection( "where2" ); 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ); 6 | t.save( { a : 2 } ); 7 | t.save( { a : 3 } ); 8 | 9 | assert.eq( 1 , t.find( { $where : "this.a == 2" } ).toArray().length , "A" ); 10 | assert.eq( 1 , t.find( { $where : "\nthis.a == 2" } ).toArray().length , "B" ); 11 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/config/abi/msvc_suffix.hpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright John Maddock 2003. 2 | // Use, modification and distribution are subject to the 3 | // Boost Software License, Version 1.0. (See accompanying file 4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #pragma pack(pop) 7 | 8 | 9 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6194.js: -------------------------------------------------------------------------------- 1 | // make sure $concat doesn't optimize constants to the end 2 | c = db.c; 3 | c.drop(); 4 | 5 | c.save( { x:'3' } ); 6 | 7 | project = { $project:{ a:{ $concat:[ '1', { $concat:[ 'foo', '$x', 'bar' ] }, '2' ] } } }; 8 | 9 | assert.eq( '1foo3bar2', c.aggregate( project ).result[ 0 ].a ); 10 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6335.js: -------------------------------------------------------------------------------- 1 | // server-6335: don't allow $where clauses in a $match 2 | 3 | // load the test utilities 4 | load('jstests/aggregation/extras/utils.js'); 5 | 6 | assertErrorCode(db.foo, {$match: {$where: "return true"}}, 16395); 7 | assertErrorCode(db.foo, {$match: {$and:[{$where: "return true"}]}}, 16395); 8 | 9 | -------------------------------------------------------------------------------- /jstests/autoid.js: -------------------------------------------------------------------------------- 1 | f = db.jstests_autoid; 2 | f.drop(); 3 | 4 | f.save( {z:1} ); 5 | a = f.findOne( {z:1} ); 6 | f.update( {z:1}, {z:2} ); 7 | b = f.findOne( {z:2} ); 8 | assert.eq( a._id.str, b._id.str ); 9 | c = f.update( {z:2}, {z:"abcdefgabcdefgabcdefg"} ); 10 | c = f.findOne( {} ); 11 | assert.eq( a._id.str, c._id.str ); 12 | -------------------------------------------------------------------------------- /jstests/js5.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.jstests_js5 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ) 6 | t.save( { a : 2 } ) 7 | 8 | assert.eq( 2 , t.find( { "$where" : "this.a" } ).count() , "A" ); 9 | assert.eq( 0 , t.find( { "$where" : "this.b" } ).count() , "B" ); 10 | assert.eq( 0 , t.find( { "$where" : "this.b > 45" } ).count() , "C" ); 11 | -------------------------------------------------------------------------------- /src/third_party/s2/strings/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env windows linux darwin solaris") 4 | 5 | env = env.Clone() 6 | 7 | env.Append(CCFLAGS=['-Isrc/third_party/s2']) 8 | 9 | env.StaticLibrary( 10 | "strings", 11 | [ 12 | "split.cc", 13 | "stringprintf.cc", 14 | "strutil.cc", 15 | ]) 16 | -------------------------------------------------------------------------------- /jstests/capped_server7543.js: -------------------------------------------------------------------------------- 1 | 2 | mydb = db.getSisterDB( "capped_server7543" ); 3 | mydb.dropDatabase(); 4 | 5 | mydb.createCollection( "foo" , { capped : true , size : 12288 } ); 6 | 7 | assert.eq( 12288, mydb.foo.stats().storageSize ); 8 | assert.eq( 1, mydb.foo.validate(true).extentCount ); 9 | 10 | mydb.dropDatabase(); 11 | 12 | -------------------------------------------------------------------------------- /jstests/ore.js: -------------------------------------------------------------------------------- 1 | // verify that index direction is considered when deduping based on an earlier 2 | // index 3 | 4 | t = db.jstests_ore; 5 | t.drop(); 6 | 7 | t.ensureIndex( {a:-1} ) 8 | t.ensureIndex( {b:1} ); 9 | 10 | t.save( {a:1,b:1} ); 11 | t.save( {a:2,b:1} ); 12 | 13 | assert.eq( 2, t.count( {$or:[{a:{$in:[1,2]}},{b:1}]} ) ); -------------------------------------------------------------------------------- /valgrind.suppressions: -------------------------------------------------------------------------------- 1 | { 2 | Command_Static_Stuff 3 | Memcheck:Leak 4 | ... 5 | fun:_ZNSsC1EPKcRKSaIcE 6 | ... 7 | } 8 | { 9 | mongod-writes-uninitialized-data-for-journal 10 | Memcheck:Param 11 | write(buf) 12 | obj:/lib64/libpthread-2.14.90.so 13 | fun:_ZN5mongo7LogFile17synchronousAppendEPKvm 14 | } 15 | -------------------------------------------------------------------------------- /jstests/dbref2.js: -------------------------------------------------------------------------------- 1 | 2 | a = db.dbref2a; 3 | b = db.dbref2b; 4 | 5 | a.drop(); 6 | b.drop(); 7 | 8 | a.save( { name : "eliot" } ); 9 | b.save( { num : 1 , link : new DBRef( "dbref2a" , a.findOne()._id ) } ); 10 | assert.eq( "eliot" , b.findOne().link.fetch().name , "A" ); 11 | assert.neq( "el" , b.findOne().link.fetch().name , "B" ); 12 | -------------------------------------------------------------------------------- /jstests/update_multi6.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_multi6 3 | t.drop(); 4 | 5 | t.update( { _id : 1 } , { _id : 1 , x : 1 , y : 2 } , true , false ); 6 | assert( t.findOne( { _id : 1 } ) , "A" ) 7 | 8 | t.update( { _id : 2 } , { _id : 2 , x : 1 , y : 2 } , true , true ); 9 | assert( db.getLastError() , "B: " + db.getLastErrorCmd() ); 10 | 11 | -------------------------------------------------------------------------------- /src/mongo/db/repl/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jstests/basic4.js: -------------------------------------------------------------------------------- 1 | t = db.getCollection( "basic4" ); 2 | t.drop(); 3 | 4 | t.save( { a : 1 , b : 1.0 } ); 5 | 6 | assert( t.findOne() ); 7 | assert( t.findOne( { a : 1 } ) ); 8 | assert( t.findOne( { a : 1.0 } ) ); 9 | assert( t.findOne( { b : 1 } ) ); 10 | assert( t.findOne( { b : 1.0 } ) ); 11 | 12 | assert( ! t.findOne( { b : 2.0 } ) ); 13 | -------------------------------------------------------------------------------- /jstests/eval0.js: -------------------------------------------------------------------------------- 1 | 2 | assert.eq( 17 , db.eval( function(){ return 11 + 6; } ) , "A" ); 3 | assert.eq( 17 , db.eval( function( x ){ return 10 + x; } , 7 ) , "B" ); 4 | 5 | // check that functions in system.js work 6 | db.system.js.insert({_id: "add", value: function(x,y){ return x + y;}}); 7 | assert.eq( 20 , db.eval( "this.add(15, 5);" ) , "C" ); 8 | 9 | -------------------------------------------------------------------------------- /jstests/indexf.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.indexf 3 | t.drop(); 4 | 5 | t.ensureIndex( { x : 1 } ); 6 | 7 | t.save( { x : 2 } ); 8 | t.save( { y : 3 } ); 9 | t.save( { x : 4 } ); 10 | 11 | assert.eq( 2 , t.findOne( { x : 2 } ).x , "A1" ); 12 | assert.eq( 3 , t.findOne( { x : null } ).y , "A2" ); 13 | assert.eq( 4 , t.findOne( { x : 4 } ).x , "A3" ); 14 | -------------------------------------------------------------------------------- /jstests/update8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update8; 3 | t.drop(); 4 | 5 | t.update( { _id : 1 , tags: {"$ne": "a"}}, {"$push": { tags : "a" } } , true ) 6 | assert.eq( { _id : 1 , tags : [ "a" ] } , t.findOne() , "A" ); 7 | 8 | t.drop() 9 | //SERVER-390 10 | //t.update( { "x.y" : 1 } , { $inc : { i : 1 } } , true ); 11 | //printjson( t.findOne() ); 12 | -------------------------------------------------------------------------------- /src/third_party/s2/base/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env windows linux darwin solaris") 4 | 5 | env = env.Clone() 6 | 7 | env.Append(CCFLAGS=['-Isrc/third_party/s2']) 8 | 9 | env.StaticLibrary( 10 | "base", 11 | [ 12 | "int128.cc", 13 | "logging.cc", 14 | "stringprintf.cc", 15 | "strtoint.cc", 16 | ]) 17 | -------------------------------------------------------------------------------- /src/third_party/v8/tools/freebsd-tick-processor: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # A wrapper script to call 'linux-tick-processor'. 4 | 5 | # Known issues on FreeBSD: 6 | # No ticks from C++ code. 7 | # You must have d8 built and in your path before calling this. 8 | 9 | tools_path=`cd $(dirname "$0");pwd` 10 | $tools_path/linux-tick-processor "$@" 11 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server7900.js: -------------------------------------------------------------------------------- 1 | // server-7900 - $sort + $limit ignores limit when using index for sort 2 | 3 | c = db.s7900; 4 | c.drop(); 5 | 6 | for (var i=0; i < 5; i++) 7 | c.insert({_id:i}); 8 | 9 | res = c.aggregate({$sort: {_id: -1}}, {$limit: 2}); // uses index for sort 10 | assert.eq(res.result, [{_id: 4}, {_id: 3}]); 11 | 12 | -------------------------------------------------------------------------------- /jstests/regexb.js: -------------------------------------------------------------------------------- 1 | // Test more than four regex expressions in a query -- SERVER-969 2 | 3 | t = db.jstests_regexb; 4 | t.drop(); 5 | 6 | t.save( {a:'a',b:'b',c:'c',d:'d',e:'e'} ); 7 | 8 | assert.eq( 1, t.count( {a:/a/,b:/b/,c:/c/,d:/d/,e:/e/} ) ); 9 | assert.eq( 0, t.count( {a:/a/,b:/b/,c:/c/,d:/d/,e:/barf/} ) ); 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /jstests/remove_justone.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.remove_justone 3 | t.drop() 4 | 5 | t.insert( { x : 1 } ) 6 | t.insert( { x : 1 } ) 7 | t.insert( { x : 1 } ) 8 | t.insert( { x : 1 } ) 9 | 10 | assert.eq( 4 , t.count() ) 11 | 12 | t.remove( { x : 1 } , true ) 13 | assert.eq( 3 , t.count() ) 14 | 15 | t.remove( { x : 1 } ) 16 | assert.eq( 0 , t.count() ) 17 | -------------------------------------------------------------------------------- /jstests/string_with_nul_bytes.js: -------------------------------------------------------------------------------- 1 | // SERVER-6649 - issues round-tripping strings with embedded NUL bytes 2 | 3 | t = db.string_with_nul_bytes.js; 4 | t.drop(); 5 | 6 | string = "string with a NUL (\0) byte"; 7 | t.insert({str:string}); 8 | assert.eq(t.findOne().str, string); 9 | assert.eq(t.findOne().str.length, string.length); // just to be sure 10 | -------------------------------------------------------------------------------- /src/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python; -*- 2 | # 3 | # This is the principle SConscript file, invoked by the SConstruct. Its job is 4 | # to delegate to any and all per-module SConscript files. 5 | 6 | Import('module_sconscripts') 7 | 8 | SConscript(['mongo/SConscript', 9 | 'third_party/SConscript'] + 10 | module_sconscripts) 11 | -------------------------------------------------------------------------------- /docs/building.opensolaris.ec2.md: -------------------------------------------------------------------------------- 1 | # Building on open solaris on ec2 2 | 3 | This assumes you are using ami-4133d528 (which is 32bit). 4 | 5 | 6 | pkg install SUNWgcc 7 | pkg install SUNWgit 8 | pkg install SUNWpython-setuptools 9 | easy_install-2.4 scons 10 | git clone git://github.com/mongodb/mongo.git 11 | cd mongo 12 | scons -------------------------------------------------------------------------------- /jstests/filemd5.js: -------------------------------------------------------------------------------- 1 | 2 | db.fs.chunks.drop(); 3 | db.fs.chunks.insert({files_id:1,n:0,data:new BinData(0,"test")}) 4 | 5 | x = db.runCommand({"filemd5":1,"root":"fs"}); 6 | assert( ! x.ok , tojson(x) ) 7 | 8 | db.fs.chunks.ensureIndex({files_id:1,n:1}) 9 | x = db.runCommand({"filemd5":1,"root":"fs"}); 10 | assert( x.ok , tojson(x) ) 11 | 12 | -------------------------------------------------------------------------------- /jstests/geo_near_random1.js: -------------------------------------------------------------------------------- 1 | // this tests all points using $near 2 | load("jstests/libs/geo_near_random.js"); 3 | 4 | var test = new GeoNearRandomTest("geo_near_random1"); 5 | 6 | test.insertPts(50); 7 | 8 | test.testPt([0,0]); 9 | test.testPt(test.mkPt()); 10 | test.testPt(test.mkPt()); 11 | test.testPt(test.mkPt()); 12 | test.testPt(test.mkPt()); 13 | -------------------------------------------------------------------------------- /jstests/geonear_validate.js: -------------------------------------------------------------------------------- 1 | // Test to make sure that geoNear validates numWanted 2 | t = db.geonear_validate 3 | t.drop(); 4 | t.ensureIndex({ geo : "2dsphere" }) 5 | origin = { "type" : "Point", "coordinates": [ 0, 0] } 6 | t.insert({geo: origin}) 7 | res = db.runCommand({geoNear: t.getName(), near: [0,0], spherical: true, num: -1}); 8 | assert.eq(0, res.ok); 9 | -------------------------------------------------------------------------------- /jstests/updatej.js: -------------------------------------------------------------------------------- 1 | // Test that update validation failure terminates the update without modifying subsequent 2 | // documents. SERVER-4779 3 | 4 | t = db.jstests_updatej; 5 | t.drop(); 6 | 7 | t.save( {a:[]} ); 8 | t.save( {a:1} ); 9 | t.save( {a:[]} ); 10 | 11 | t.update( {}, {$push:{a:2}}, false, true ); 12 | assert.eq( 1, t.count( {a:2} ) ); 13 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6181.js: -------------------------------------------------------------------------------- 1 | // SERVER-6181 Correctly support an expression for _id 2 | 3 | c = db.c; 4 | c.drop(); 5 | 6 | c.save( { a:2 } ); 7 | 8 | res = c.aggregate( { $project:{ _id:'$a' } } ) 9 | assert.eq(res.result, [{_id:2}]) 10 | 11 | res = c.aggregate( { $project:{ _id:{$add: [1, '$a']} } } ) 12 | assert.eq(res.result, [{_id:3}]) 13 | -------------------------------------------------------------------------------- /jstests/array1.js: -------------------------------------------------------------------------------- 1 | t = db.array1 2 | t.drop() 3 | 4 | x = { a : [ 1 , 2 ] }; 5 | 6 | t.save( { a : [ [1,2] ] } ); 7 | assert.eq( 1 , t.find( x ).count() , "A" ); 8 | 9 | t.save( x ); 10 | delete x._id; 11 | assert.eq( 2 , t.find( x ).count() , "B" ); 12 | 13 | t.ensureIndex( { a : 1 } ); 14 | assert.eq( 2 , t.find( x ).count() , "C" ); // TODO SERVER-146 15 | -------------------------------------------------------------------------------- /jstests/js1.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | t = db.jstests_js1; 4 | t.remove( {} ); 5 | 6 | t.save( { z : 1 } ); 7 | t.save( { z : 2 } ); 8 | assert( 2 == t.find().length() ); 9 | assert( 2 == t.find( { $where : function(){ return 1; } } ).length() ); 10 | assert( 1 == t.find( { $where : function(){ return obj.z == 2; } } ).length() ); 11 | 12 | assert(t.validate().valid); 13 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcrecpp.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: libpcrecpp 9 | Description: PCRECPP - C++ wrapper for PCRE 10 | Version: 8.30 11 | Libs: -L${libdir} -lpcre -lpcrecpp 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /jstests/auth/disable_localhost_bypass.js: -------------------------------------------------------------------------------- 1 | var conn = MongoRunner.runMongod({ auth: "", smallfiles: ""}); 2 | 3 | var test = conn.getDB("test"); 4 | 5 | test.foo.insert({a:1}); 6 | assert.eq(1, test.foo.findOne().a); 7 | 8 | conn.getDB("admin").runCommand({setParameter:1, enableLocalhostAuthBypass:false}); 9 | 10 | assert.throws(function() { db.foo.findOne(); }); -------------------------------------------------------------------------------- /jstests/geo4.js: -------------------------------------------------------------------------------- 1 | var t = db.geo4; 2 | t.drop(); 3 | 4 | t.insert( { zip : "06525" , loc : [ 41.352964 , 73.01212 ] } ); 5 | 6 | t.ensureIndex( { loc : "2d" }, { bits : 33 } ); 7 | assert.eq( db.getLastError() , "bits in geo index must be between 1 and 32" , "a" ); 8 | 9 | t.ensureIndex( { loc : "2d" }, { bits : 32 } ); 10 | assert( !db.getLastError(), "b" ); 11 | -------------------------------------------------------------------------------- /jstests/geoa.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.geoa 3 | t.drop(); 4 | 5 | t.save( { _id : 1 , a : { loc : [ 5 , 5 ] } } ) 6 | t.save( { _id : 2 , a : { loc : [ 6 , 6 ] } } ) 7 | t.save( { _id : 3 , a : { loc : [ 7 , 7 ] } } ) 8 | 9 | t.ensureIndex( { "a.loc" : "2d" } ); 10 | 11 | cur = t.find( { "a.loc" : { $near : [ 6 , 6 ] } } ); 12 | assert.eq( 2 , cur.next()._id , "A1" ); 13 | -------------------------------------------------------------------------------- /jstests/indexg.js: -------------------------------------------------------------------------------- 1 | 2 | f = db.jstests_indexg; 3 | f.drop(); 4 | f.save( { list: [1, 2] } ); 5 | f.save( { list: [1, 3] } ); 6 | 7 | doit = function() { 8 | assert.eq( 1, f.count( { list: { $in: [1], $ne: 3 } } ) ); 9 | assert.eq( 1, f.count( { list: { $in: [1], $not:{$in: [3] } } } ) ); 10 | } 11 | doit(); 12 | f.ensureIndex( { list: 1 } ); 13 | doit(); -------------------------------------------------------------------------------- /jstests/pull_remove1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.pull_remove1 3 | t.drop() 4 | 5 | o = { _id : 1 , a : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] } 6 | t.insert( o ) 7 | 8 | assert.eq( o , t.findOne() , "A1" ) 9 | 10 | o.a = o.a.filter( function(z){ return z >= 6; } ) 11 | t.update( {} , { $pull : { a : { $lt : 6 } } } ) 12 | 13 | assert.eq( o.a , t.findOne().a , "A2" ) 14 | 15 | -------------------------------------------------------------------------------- /jstests/orl.js: -------------------------------------------------------------------------------- 1 | // SERVER-3445 Test using coarse multikey bounds for or range elimination. 2 | 3 | t = db.jstests_orl; 4 | t.drop(); 5 | 6 | t.ensureIndex( {'a.b':1,'a.c':1} ); 7 | // make the index multikey 8 | t.save( {a:{b:[1,2]}} ); 9 | 10 | // SERVER-3445 11 | if ( 0 ) { 12 | assert( !t.find( {$or:[{'a.b':2,'a.c':3},{'a.b':2,'a.c':4}]} ).explain().clauses ); 13 | } -------------------------------------------------------------------------------- /src/third_party/boost/boost/typeof/message.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2005 Arkadiy Vertleyb 2 | // Use, modification and distribution is subject to the Boost Software 3 | // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #if defined(_MSC_VER) && defined BOOST_TYPEOF_MESSAGES 6 | # pragma message(BOOST_TYPEOF_TEXT) 7 | #endif 8 | #undef BOOST_TYPEOF_TEXT 9 | -------------------------------------------------------------------------------- /src/third_party/s2/base/definer.h: -------------------------------------------------------------------------------- 1 | #ifndef BASE_DEFINER_H 2 | #define BASE_DEFINER_H 3 | 4 | #if defined __APPLE__ && defined __MACH__ 5 | # define OS_MACOSX 6 | #elif defined __linux__ 7 | # define OS_LINUX 8 | #elif defined _WIN32 9 | # define OS_WINDOWS 10 | #elif defined __freebsd__ 11 | # define OS_FREEBSD 12 | #endif 13 | 14 | #endif // BASE_DEFINER_H 15 | -------------------------------------------------------------------------------- /src/third_party/s2/util/coding/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env windows linux darwin solaris") 4 | 5 | env = env.Clone() 6 | 7 | env.Append(CCFLAGS=['-Isrc/third_party/s2']) 8 | env.Append(CCFLAGS=['-Isrc/third_party/gflags-2.0/src']) 9 | 10 | env.StaticLibrary( 11 | "coding", 12 | [ 13 | "coder.cc", 14 | "varint.cc", 15 | ]) 16 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/swap.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Joseph Gauterin 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See 4 | // accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #ifndef BOOST_SWAP_HPP 8 | #define BOOST_SWAP_HPP 9 | 10 | #include "boost/utility/swap.hpp" 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | # Example watch control file for uscan 2 | # Rename this file to "watch" and then you can run the "uscan" command 3 | # to check for upstream updates and more. 4 | # See uscan(1) for format 5 | 6 | # Compulsory line, this is a version 3 file 7 | version=3 8 | 9 | # examine a Webserver directory 10 | http://downloads.mongodb.org/linux/mongodb-linux-(.*)\.tar\.gz 11 | -------------------------------------------------------------------------------- /jstests/ref2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.ref2; 3 | t.drop(); 4 | 5 | a = { $ref : "foo" , $id : 1 }; 6 | b = { $ref : "foo" , $id : 2 }; 7 | 8 | 9 | t.save( { name : "a" , r : a } ); 10 | t.save( { name : "b" , r : b } ); 11 | 12 | assert.eq( 2 , t.find().count() , "A" ); 13 | assert.eq( 1 , t.find( { r : a } ).count() , "B" ); 14 | assert.eq( 1 , t.find( { r : b } ).count() , "C" ); 15 | -------------------------------------------------------------------------------- /jstests/update_multi5.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_multi5; 3 | 4 | t.drop() 5 | 6 | t.insert({path: 'r1', subscribers: [1,2]}); 7 | t.insert({path: 'r2', subscribers: [3,4]}); 8 | 9 | t.update({}, {$addToSet: {subscribers: 5}}, false, true); 10 | 11 | t.find().forEach( 12 | function(z){ 13 | assert.eq( 3 , z.subscribers.length , z ); 14 | } 15 | ); 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcrecpp.pc.in: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libpcrecpp 9 | Description: PCRECPP - C++ wrapper for PCRE 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lpcre -lpcrecpp 12 | Cflags: -I${includedir} @PCRE_STATIC_CFLAG@ 13 | -------------------------------------------------------------------------------- /jstests/date2.js: -------------------------------------------------------------------------------- 1 | // Check that it's possible to compare a Date to a Timestamp - SERVER-3304 2 | // Check Date / Timestamp comparison equivalence - SERVER-3222 3 | 4 | t = db.jstests_date2; 5 | t.drop(); 6 | 7 | t.ensureIndex( {a:1} ); 8 | 9 | t.save( {a:new Timestamp()} ); 10 | 11 | if ( 0 ) { // SERVER-3304 12 | assert.eq( 1, t.find( {a:{$gt:new Date(0)}} ).itcount() ); 13 | } 14 | -------------------------------------------------------------------------------- /jstests/slowNightly/geo_near_random1.js: -------------------------------------------------------------------------------- 1 | // this tests all points using $near 2 | load("jstests/libs/geo_near_random.js"); 3 | 4 | var test = new GeoNearRandomTest("nightly.geo_near_random1"); 5 | 6 | test.insertPts(200); 7 | 8 | test.testPt([0,0]); 9 | test.testPt(test.mkPt()); 10 | test.testPt(test.mkPt()); 11 | test.testPt(test.mkPt()); 12 | test.testPt(test.mkPt()); 13 | 14 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/config/abi/borland_suffix.hpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright John Maddock 2003. 2 | // Use, modification and distribution are subject to the 3 | // Boost Software License, Version 1.0. (See accompanying file 4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | # pragma option pop 7 | #pragma nopushoptwarn 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /jstests/basic2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.getCollection( "basic2" ); 3 | t.drop(); 4 | 5 | o = { n : 2 }; 6 | t.save( o ); 7 | 8 | assert.eq( 1 , t.find().count() ); 9 | 10 | assert.eq( 2 , t.find( o._id ).toArray()[0].n ); 11 | assert.eq( 2 , t.find( o._id , { n : 1 } ).toArray()[0].n ); 12 | 13 | t.remove( o._id ); 14 | assert.eq( 0 , t.find().count() ); 15 | 16 | assert(t.validate().valid); 17 | -------------------------------------------------------------------------------- /jstests/set3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set3; 3 | t.drop(); 4 | 5 | t.insert( { "test1" : { "test2" : { "abcdefghijklmnopqrstu" : {"id":1} } } } ); 6 | t.update( {}, {"$set":{"test1.test2.abcdefghijklmnopqrstuvwxyz":{"id":2}}}) 7 | 8 | x = t.findOne(); 9 | assert.eq( 1 , x.test1.test2.abcdefghijklmnopqrstu.id , "A" ); 10 | assert.eq( 2 , x.test1.test2.abcdefghijklmnopqrstuvwxyz.id , "B" ); 11 | 12 | -------------------------------------------------------------------------------- /jstests/eval8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval8; 3 | t.drop(); 4 | 5 | x = { a : 1 , b : 2 }; 6 | t.save( x ); 7 | x = t.findOne(); 8 | 9 | assert( x.a && x.b , "A" ); 10 | delete x.b; 11 | 12 | assert( x.a && ! x.b , "B" ) 13 | x.b = 3; 14 | assert( x.a && x.b , "C" ); 15 | assert.eq( 3 , x.b , "D" ); 16 | 17 | t.save( x ); 18 | y = t.findOne(); 19 | assert.eq( tojson( x ) , tojson( y ) , "E" ); 20 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcre.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: libpcre 9 | Description: PCRE - Perl compatible regular expressions C library with 8 bit character support 10 | Version: 8.30 11 | Libs: -L${libdir} -lpcre 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /jstests/counta.js: -------------------------------------------------------------------------------- 1 | // Check that count returns 0 in some exception cases. 2 | 3 | t = db.jstests_counta; 4 | t.drop(); 5 | 6 | for( i = 0; i < 10; ++i ) { 7 | t.save( {a:i} ); 8 | } 9 | 10 | // f() is undefined, causing an assertion 11 | assert.throws( 12 | function(){ 13 | t.count( { $where:function() { if ( this.a < 5 ) { return true; } else { f(); } } } ); 14 | } ); 15 | -------------------------------------------------------------------------------- /jstests/dbcase2.js: -------------------------------------------------------------------------------- 1 | // SERVER-2111 Check that an in memory db name will block creation of a db with a similar but differently cased name. 2 | 3 | a = db.getSisterDB( "dbcase2test_dbnamea" ) 4 | b = db.getSisterDB( "dbcase2test_dbnameA" ) 5 | 6 | a.c.count(); 7 | assert.throws( function() { b.c.count() } ); 8 | 9 | assert.eq( -1, db.getMongo().getDBNames().indexOf( "dbcase2test_dbnameA" ) ); 10 | -------------------------------------------------------------------------------- /jstests/temp_cleanup.js: -------------------------------------------------------------------------------- 1 | 2 | mydb = db.getSisterDB( "temp_cleanup_test" ) 3 | 4 | t = mydb.tempCleanup 5 | t.drop() 6 | 7 | t.insert( { x : 1 } ) 8 | 9 | res = t.mapReduce( function(){ emit(1,1); } , function(){ return 1; } , "xyz" ); 10 | printjson( res ); 11 | 12 | assert.eq( 1 , t.count() , "A1" ) 13 | assert.eq( 1 , mydb[res.result].count() , "A2" ) 14 | 15 | mydb.dropDatabase() 16 | 17 | -------------------------------------------------------------------------------- /src/mongo/util/mongoutils/mongoutils.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcre16.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: libpcre16 9 | Description: PCRE - Perl compatible regular expressions C library with 16 bit character support 10 | Version: 8.30 11 | Libs: -L${libdir} -lpcre16 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /jstests/in3.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_in3; 2 | 3 | t.drop(); 4 | t.ensureIndex( {i:1} ); 5 | assert.eq( {i:[[3,3]]}, t.find( {i:{$in:[3]}} ).explain().indexBounds , "A1" ); 6 | assert.eq( {i:[[3,3],[6,6]]}, t.find( {i:{$in:[3,6]}} ).explain().indexBounds , "A2" ); 7 | 8 | for ( var i=0; i<20; i++ ) 9 | t.insert( { i : i } ); 10 | 11 | assert.eq( 3 , t.find( {i:{$in:[3,6]}} ).explain().nscanned , "B1" ) 12 | -------------------------------------------------------------------------------- /jstests/set_param1.js: -------------------------------------------------------------------------------- 1 | 2 | old = db.adminCommand( { "getParameter" : "*" } ) 3 | tmp1 = db.adminCommand( { "setParameter" : 1 , "logLevel" : 5 } ) 4 | tmp2 = db.adminCommand( { "setParameter" : 1 , "logLevel" : old.logLevel } ) 5 | now = db.adminCommand( { "getParameter" : "*" } ) 6 | 7 | assert.eq( old , now , "A" ) 8 | assert.eq( old.logLevel , tmp1.was , "B" ) 9 | assert.eq( 5 , tmp2.was , "C" ) 10 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/bcc551/quote.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2000-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/quote.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/msvc60/quote.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2000-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/quote.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/no_ttp/quote.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2000-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/quote.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcreposix.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: libpcreposix 9 | Description: PCREPosix - Posix compatible interface to libpcre 10 | Version: 8.30 11 | Libs: -L${libdir} -lpcreposix 12 | Cflags: -I${includedir} 13 | Requires.private: libpcre 14 | -------------------------------------------------------------------------------- /jstests/date1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.date1; 3 | 4 | 5 | function go( d , msg ){ 6 | t.drop(); 7 | t.save({ a: 1, d: d }); 8 | // printjson(d); 9 | // printjson(t.findOne().d); 10 | assert.eq( d , t.findOne().d , msg ) 11 | } 12 | 13 | go( new Date() , "A" ) 14 | go( new Date( 1 ) , "B") 15 | go( new Date( 0 ) , "C (old spidermonkey lib fails this test)") 16 | go(new Date(-10), "neg") 17 | 18 | -------------------------------------------------------------------------------- /jstests/find2.js: -------------------------------------------------------------------------------- 1 | // Test object id sorting. 2 | 3 | function testObjectIdFind( db ) { 4 | r = db.ed_db_find2_oif; 5 | r.drop(); 6 | 7 | for( i = 0; i < 3; ++i ) 8 | r.save( {} ); 9 | 10 | f = r.find().sort( { _id: 1 } ); 11 | assert.eq( 3, f.count() ); 12 | assert( f[ 0 ]._id < f[ 1 ]._id ); 13 | assert( f[ 1 ]._id < f[ 2 ]._id ); 14 | } 15 | 16 | testObjectIdFind( db ); 17 | -------------------------------------------------------------------------------- /jstests/find_and_modify_server7660.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.find_and_modify_server7660; 3 | t.drop(); 4 | 5 | a = t.findAndModify({ 6 | query : { foo : 'bar' }, 7 | update : { $set : { bob : 'john' } }, 8 | sort: { foo : 1}, 9 | upsert: true, 10 | new : true 11 | }); 12 | 13 | b = t.findOne(); 14 | assert.eq( a, b ); 15 | assert.eq( "bar", a.foo ); 16 | assert.eq( "john", a.bob ) 17 | 18 | 19 | -------------------------------------------------------------------------------- /jstests/where3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.where3; 3 | t.drop() 4 | 5 | t.save( { returned_date : 5 } ); 6 | t.save( { returned_date : 6 } ); 7 | 8 | assert.eq( 1 , t.find( function(){ return this.returned_date == 5; } ).count() , "A" ); 9 | assert.eq( 1 , t.find( { $where : "return this.returned_date == 5;" } ).count() , "B" ); 10 | assert.eq( 1 , t.find( { $where : "this.returned_date == 5;" } ).count() , "C" ); 11 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2000-2008 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // *Preprocessed* version of the main "quote.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /jstests/array_match3.js: -------------------------------------------------------------------------------- 1 | // SERVER-2902 Test indexing of numerically referenced array elements. 2 | 3 | t = db.jstests_array_match3; 4 | t.drop(); 5 | 6 | // Test matching numericallly referenced array element. 7 | t.save( {a:{'0':5}} ); 8 | t.save( {a:[5]} ); 9 | assert.eq( 2, t.count( {'a.0':5} ) ); 10 | 11 | // Test with index. 12 | t.ensureIndex( {'a.0':1} ); 13 | assert.eq( 2, t.count( {'a.0':5} ) ); 14 | -------------------------------------------------------------------------------- /jstests/rename2.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | a = db.rename2a; 4 | b = db.rename2b; 5 | 6 | a.drop(); 7 | b.drop(); 8 | 9 | a.save( { x : 1 } ) 10 | a.save( { x : 2 } ) 11 | a.save( { x : 3 } ) 12 | 13 | assert.eq( 3 , a.count() , "A" ) 14 | assert.eq( 0 , b.count() , "B" ) 15 | 16 | assert( a.renameCollection( "rename2b" ) , "the command" ); 17 | 18 | assert.eq( 0 , a.count() , "C" ) 19 | assert.eq( 3 , b.count() , "D" ) 20 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcre.pc.in: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libpcre 9 | Description: PCRE - Perl compatible regular expressions C library with 8 bit character support 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lpcre 12 | Cflags: -I${includedir} @PCRE_STATIC_CFLAG@ 13 | -------------------------------------------------------------------------------- /jstests/db.js: -------------------------------------------------------------------------------- 1 | function testInvalidDBNameThrowsExceptionWithConstructor() { 2 | assert.throws( function() { return new DB( null, "/\\" ); } ); 3 | } 4 | 5 | function testInvalidDBNameThrowsExceptionWithSibling() { 6 | assert.throws( function() { return db.getSiblingDB( "/\\" ); } ); 7 | } 8 | 9 | testInvalidDBNameThrowsExceptionWithConstructor(); 10 | testInvalidDBNameThrowsExceptionWithSibling(); 11 | 12 | -------------------------------------------------------------------------------- /jstests/remove3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.remove3; 3 | t.drop(); 4 | 5 | for ( i=1; i<=8; i++){ 6 | t.save( { _id : i , x : i } ); 7 | } 8 | 9 | assert.eq( 8 , t.count() , "A" ); 10 | 11 | t.remove( { x : { $lt : 5 } } ); 12 | assert.eq( 4 , t.count() , "B" ); 13 | 14 | t.remove( { _id : 5 } ); 15 | assert.eq( 3 , t.count() , "C" ); 16 | 17 | t.remove( { _id : { $lt : 8 } } ); 18 | assert.eq( 1 , t.count() , "D" ); 19 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcre16.pc.in: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libpcre16 9 | Description: PCRE - Perl compatible regular expressions C library with 16 bit character support 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lpcre16 12 | Cflags: -I${includedir} @PCRE_STATIC_CFLAG@ 13 | -------------------------------------------------------------------------------- /jstests/bad_index_plugin.js: -------------------------------------------------------------------------------- 1 | // SERVER-5826 ensure you can't build an index with a non-existent plugin 2 | t = db.bad_index_plugin; 3 | 4 | assert.eq(t.ensureIndex({good: 1}), undefined); 5 | assert.eq(t.getIndexes().length, 2); // good + _id 6 | 7 | err = t.ensureIndex({bad: 'bad'}); 8 | assert.neq(err, undefined); 9 | assert.eq(err.code, 16734); 10 | 11 | assert.eq(t.getIndexes().length, 2); // good + _id (no bad) 12 | -------------------------------------------------------------------------------- /jstests/count4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.count4; 3 | t.drop(); 4 | 5 | for ( i=0; i<100; i++ ){ 6 | t.save( { x : i } ); 7 | } 8 | 9 | q = { x : { $gt : 25 , $lte : 75 } } 10 | 11 | assert.eq( 50 , t.find( q ).count() , "A" ); 12 | assert.eq( 50 , t.find( q ).itcount() , "B" ); 13 | 14 | t.ensureIndex( { x : 1 } ); 15 | 16 | assert.eq( 50 , t.find( q ).count() , "C" ); 17 | assert.eq( 50 , t.find( q ).itcount() , "D" ); 18 | -------------------------------------------------------------------------------- /jstests/error2.js: -------------------------------------------------------------------------------- 1 | // Test that client gets stack trace on failed invoke 2 | 3 | f = db.jstests_error2; 4 | 5 | f.drop(); 6 | 7 | f.save( {a:1} ); 8 | 9 | assert.throws( 10 | function(){ 11 | c = f.find({$where : function(){ return a() }}); 12 | c.next(); 13 | } 14 | ); 15 | 16 | assert.throws( 17 | function(){ 18 | db.eval( function() { return a(); } ); 19 | } 20 | ); 21 | 22 | -------------------------------------------------------------------------------- /jstests/objid1.js: -------------------------------------------------------------------------------- 1 | t = db.objid1; 2 | t.drop(); 3 | 4 | b = new ObjectId(); 5 | assert( b.str , "A" ); 6 | 7 | a = new ObjectId( b.str ); 8 | assert.eq( a.str , b.str , "B" ); 9 | 10 | t.save( { a : a } ) 11 | assert( t.findOne().a.isObjectId , "C" ); 12 | assert.eq( a.str , t.findOne().a.str , "D" ); 13 | 14 | x = { a : new ObjectId() }; 15 | eval( " y = " + tojson( x ) ); 16 | assert.eq( x.a.str , y.a.str , "E" ); 17 | -------------------------------------------------------------------------------- /jstests/objid7.js: -------------------------------------------------------------------------------- 1 | 2 | a = new ObjectId( "4c1a478603eba73620000000" ) 3 | b = new ObjectId( "4c1a478603eba73620000000" ) 4 | c = new ObjectId(); 5 | 6 | assert.eq( a.toString() , b.toString() , "A" ) 7 | assert.eq( a.toString() , "ObjectId(\"4c1a478603eba73620000000\")" , "B" ); 8 | 9 | assert( a.equals( b ) , "C" ) 10 | 11 | assert.neq( a.toString() , c.toString() , "D" ); 12 | assert( ! a.equals( c ) , "E" ); 13 | 14 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/dmc/template_arity.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2001-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/mwcw/template_arity.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2001-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/mpl/aux_/preprocessed/plain/template_arity.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright Aleksey Gurtovoy 2001-2004 3 | // 4 | // Distributed under the Boost Software License, Version 1.0. 5 | // (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | // 8 | 9 | // Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header 10 | // -- DO NOT modify by hand! 11 | 12 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server5973.js: -------------------------------------------------------------------------------- 1 | // https://jira.mongodb.org/browse/SERVER-5369 2 | // correctly sort dates before 1970 3 | 4 | // use the aggregation test db 5 | db = db.getSiblingDB('aggdb'); 6 | 7 | db.test.drop(); 8 | db.test.insert({d:ISODate('1950-01-01')}) 9 | db.test.insert({d:ISODate('1980-01-01')}) 10 | 11 | var out = db.test.aggregate({$sort:{d:1}}); 12 | 13 | assert.lt(out.result[0].d, out.result[1].d) 14 | -------------------------------------------------------------------------------- /jstests/eval_nolock.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval_nolock 3 | t.drop(); 4 | 5 | for ( i=0; i<10; i++ ) 6 | t.insert( { _id : i } ); 7 | 8 | res = db.runCommand( { eval : 9 | function(){ 10 | db.eval_nolock.insert( { _id : 123 } ); 11 | return db.eval_nolock.count(); 12 | } 13 | , nolock : true } ); 14 | 15 | assert.eq( 11 , res.retval , "A" ) 16 | 17 | -------------------------------------------------------------------------------- /jstests/index_check7.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.index_check7 3 | t.drop() 4 | 5 | for ( var i=0; i<100; i++ ) 6 | t.save( { x : i } ) 7 | 8 | t.ensureIndex( { x : 1 } ) 9 | assert.eq( 1 , t.find( { x : 27 } ).explain().nscanned , "A" ) 10 | 11 | t.ensureIndex( { x : -1 } ) 12 | assert.eq( 1 , t.find( { x : 27 } ).explain().nscanned , "B" ) 13 | 14 | assert.eq( 40 , t.find( { x : { $gt : 59 } } ).explain().nscanned , "C" ); 15 | 16 | -------------------------------------------------------------------------------- /jstests/misc/biginsert.js: -------------------------------------------------------------------------------- 1 | o = "xxxxxxxxxxxxxxxxxxx"; 2 | o = o + o; 3 | o + o; 4 | o = o + o; 5 | o = o + o; 6 | o = o + o; 7 | 8 | var B = 40000; 9 | var last = new Date(); 10 | for (i = 0; i < 30000000; i++) { 11 | db.foo.insert({ o: o }); 12 | if (i % B == 0) { 13 | var n = new Date(); 14 | print(i); 15 | print("per sec: " + B*1000 / (n - last)); 16 | last = n; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_dutch.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * dutch_UTF_8_create_env(void); 9 | extern void dutch_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int dutch_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/pcre-8.30/libpcreposix.pc.in: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libpcreposix 9 | Description: PCREPosix - Posix compatible interface to libpcre 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lpcreposix 12 | Cflags: -I${includedir} @PCRE_STATIC_CFLAG@ 13 | Requires.private: libpcre 14 | -------------------------------------------------------------------------------- /jstests/indexi.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_indexi; 2 | 3 | t.drop(); 4 | 5 | for( var a = 0; a < 10; ++a ) { 6 | for( var b = 0; b < 10; ++b ) { 7 | for( var c = 0; c < 10; ++c ) { 8 | t.save( {a:a,b:b,c:c} ); 9 | } 10 | } 11 | } 12 | 13 | t.ensureIndex( {a:1,b:1,c:1} ); 14 | t.ensureIndex( {a:1,c:1} ); 15 | 16 | assert.automsg( "!t.find( {a:{$gt:1,$lt:10},c:{$gt:1,$lt:10}} ).explain().indexBounds.b" ); -------------------------------------------------------------------------------- /jstests/set4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set4; 3 | t.drop(); 4 | 5 | orig = { _id:1 , a : [ { x : 1 } ]} 6 | t.insert( orig ); 7 | 8 | t.update( {}, { $set : { 'a.0.x' : 2, 'foo.bar' : 3 } } ); 9 | orig.a[0].x = 2; orig.foo = { bar : 3 } 10 | assert.eq( orig , t.findOne() , "A" ); 11 | 12 | t.update( {}, { $set : { 'a.0.x' : 4, 'foo.bar' : 5 } } ); 13 | orig.a[0].x = 4; orig.foo.bar = 5; 14 | assert.eq( orig , t.findOne() , "B" ); 15 | 16 | -------------------------------------------------------------------------------- /jstests/set5.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set5; 3 | t.drop(); 4 | 5 | function check( want , err ){ 6 | var x = t.findOne(); 7 | delete x._id; 8 | assert.eq( want , x , err ); 9 | } 10 | 11 | t.update( { a : 5 } , { $set : { a : 6 , b : null } } , true ); 12 | check( { a : 6 , b : null } , "A" ) 13 | 14 | t.drop(); 15 | 16 | t.update( { z : 5 } , { $set : { z : 6 , b : null } } , true ); 17 | check( { b : null , z : 6 } , "B" ) 18 | -------------------------------------------------------------------------------- /jstests/slowNightly/huge_multikey_index.js: -------------------------------------------------------------------------------- 1 | // https://jira.mongodb.org/browse/SERVER-4534 2 | t = db.huge_multikey_index 3 | t.drop() 4 | 5 | function doit() { 6 | arr = [] 7 | for (var i=0; i< 1000*1000;i++) 8 | arr.push(i); 9 | 10 | t.insert({a:arr}) 11 | 12 | //t.ensureIndex({a:1}, {background:true}) // works! 13 | 14 | t.ensureIndex({a:1}) // boom! 15 | } 16 | 17 | // doit(); // SERVER-4534 18 | -------------------------------------------------------------------------------- /jstests/update_arraymatch6.js: -------------------------------------------------------------------------------- 1 | t = db.jstests_update_arraymatch6; 2 | t.drop(); 3 | 4 | function doTest() { 5 | t.save( {a: [{id: 1, x: [5,6,7]}, {id: 2, x: [8,9,10]}]} ); 6 | t.update({'a.id': 1}, {$set: {'a.$.x': [1,1,1]}}); 7 | assert.automsg( "!db.getLastError()" ); 8 | assert.eq.automsg( "1", "t.findOne().a[ 0 ].x[ 0 ]" ); 9 | } 10 | 11 | doTest(); 12 | t.drop(); 13 | t.ensureIndex( { 'a.id':1 } ); 14 | doTest(); -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_danish.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * danish_UTF_8_create_env(void); 9 | extern void danish_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int danish_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_french.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * french_UTF_8_create_env(void); 9 | extern void french_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int french_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_german.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * german_UTF_8_create_env(void); 9 | extern void german_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int german_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_porter.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * porter_UTF_8_create_env(void); 9 | extern void porter_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int porter_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /jstests/eval1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval1; 3 | t.drop(); 4 | 5 | t.save( { _id : 1 , name : "eliot" } ); 6 | t.save( { _id : 2 , name : "sara" } ); 7 | 8 | f = function(id){ 9 | return db["eval1"].findOne( { _id : id } ).name; 10 | } 11 | 12 | 13 | assert.eq( "eliot" , f( 1 ) , "A" ); 14 | assert.eq( "sara" , f( 2 ) , "B" ); 15 | assert.eq( "eliot" , db.eval( f , 1 ) , "C" ); 16 | assert.eq( "sara" , db.eval( f , 2 ) , "D" ); 17 | 18 | -------------------------------------------------------------------------------- /jstests/geo_s2selfintersectingpoly.js: -------------------------------------------------------------------------------- 1 | var t = db.geo_s2selfintersectingpoly; 2 | t.drop(); 3 | t.ensureIndex({geo: "2dsphere"}); 4 | 5 | var intersectingPolygon = {"type": "Polygon", "coordinates": [ 6 | [[0.0, 0.0], [0.0, 4.0], [-3.0, 2.0], [1.0, 2.0], [0.0, 0.0]] 7 | ]}; 8 | /* 9 | * Self intersecting polygons should cause a parse exception. 10 | */ 11 | t.insert({geo : intersectingPolygon}); 12 | assert(db.getLastError()); 13 | -------------------------------------------------------------------------------- /jstests/maxscan.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.maxscan; 3 | t.drop(); 4 | 5 | N = 100; 6 | for ( i=0; i 0" ); 12 | 13 | assert.commandWorked( m.getDB( "local" ).repairDatabase() ); 14 | assert.automsg( "c <= m.getDB( 'local' ).oplog.$main.count()" ); 15 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/example/test/setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright Beman Dawes, 2010 3 | rem Distributed under the Boost Software License, Version 1.0. 4 | rem See www.boost.org/LICENSE_1_0.txt 5 | 6 | copy /y ..\tut1.cpp >nul 7 | copy /y ..\tut2.cpp >nul 8 | copy /y ..\tut3.cpp >nul 9 | copy /y ..\tut4.cpp >nul 10 | copy /y ..\tut5.cpp >nul 11 | copy /y ..\path_info.cpp >nul 12 | del *.exe 2>nul 13 | del *.pdb 2>nul 14 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_ISO_8859_1_dutch.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * dutch_ISO_8859_1_create_env(void); 9 | extern void dutch_ISO_8859_1_close_env(struct SN_env * z); 10 | 11 | extern int dutch_ISO_8859_1_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_UTF_8_portuguese.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * portuguese_UTF_8_create_env(void); 9 | extern void portuguese_UTF_8_close_env(struct SN_env * z); 10 | 11 | extern int portuguese_UTF_8_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /jstests/indexw.js: -------------------------------------------------------------------------------- 1 | // Check that v0 keys are generated for v0 indexes SERVER-3375 2 | 3 | t = db.jstests_indexw; 4 | t.drop(); 5 | 6 | t.save( {a:[]} ); 7 | assert.eq( 1, t.count( {a:[]} ) ); 8 | t.ensureIndex( {a:1} ); 9 | assert.eq( 1, t.count( {a:[]} ) ); 10 | t.dropIndexes(); 11 | 12 | // The count result is incorrect - just checking here that v0 key generation is used. 13 | t.ensureIndex( {a:1}, {v:0} ); 14 | assert.eq( 0, t.count( {a:[]} ) ); 15 | -------------------------------------------------------------------------------- /jstests/objid4.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | o = new ObjectId(); 5 | assert( o.str ); 6 | 7 | a = new ObjectId( o.str ); 8 | assert.eq( o.str , a.str ); 9 | assert.eq( a.str , a.str.toString() ) 10 | 11 | b = ObjectId( o.str ); 12 | assert.eq( o.str , b.str ); 13 | assert.eq( b.str , b.str.toString() ) 14 | 15 | assert.throws( function(z){ return new ObjectId( "a" ); } ); 16 | assert.throws( function(z){ return new ObjectId( "12345678901234567890123z" ); } ); 17 | -------------------------------------------------------------------------------- /jstests/remove8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.remove8; 3 | t.drop(); 4 | 5 | N = 1000; 6 | 7 | function fill(){ 8 | for ( var i=0; i 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_ISO_8859_1_hungarian.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * hungarian_ISO_8859_1_create_env(void); 9 | extern void hungarian_ISO_8859_1_close_env(struct SN_env * z); 10 | 11 | extern int hungarian_ISO_8859_1_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_ISO_8859_1_norwegian.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * norwegian_ISO_8859_1_create_env(void); 9 | extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); 10 | 11 | extern int norwegian_ISO_8859_1_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /jstests/ork.js: -------------------------------------------------------------------------------- 1 | // SERVER-2585 Test $or clauses within indexed top level $or clauses. 2 | 3 | t = db.jstests_ork; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1} ); 7 | t.save( {a:[1,2],b:5} ); 8 | t.save( {a:[2,4],b:5} ); 9 | 10 | assert.eq( 2, t.find( {$or:[{a:1,$and:[{$or:[{a:2},{a:3}]},{$or:[{b:5}]}]},{a:2,$or:[{a:3},{a:4}]}]} ).itcount() ); 11 | assert.eq( 1, t.find( {$or:[{a:1,$and:[{$or:[{a:2},{a:3}]},{$or:[{b:6}]}]},{a:2,$or:[{a:3},{a:4}]}]} ).itcount() ); 12 | -------------------------------------------------------------------------------- /jstests/sharding/sync3.js: -------------------------------------------------------------------------------- 1 | // NOTE: this test is skipped when running smoke.py with --auth or --keyFile to force authentication 2 | // in all tests. 3 | var bitbucket = _isWindows() ? "NUL" : "/dev/null"; 4 | test = new SyncCCTest( "sync3" )//, { logpath : bitbucket } ) 5 | 6 | x = test._connections[0].getDB( "admin" ).runCommand( { "_testDistLockWithSyncCluster" : 1 , host : test.url } ) 7 | printjson( x ) 8 | assert( x.ok ); 9 | 10 | 11 | 12 | test.stop(); 13 | -------------------------------------------------------------------------------- /jstests/update_multi4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_mulit4; 3 | t.drop(); 4 | 5 | for(i=0;i<1000;i++){ 6 | t.insert( { _id:i , 7 | k:i%12, 8 | v:"v"+i%12 } ); 9 | } 10 | 11 | t.ensureIndex({k:1}) 12 | 13 | assert.eq( 84 , t.count({k:2,v:"v2"} ) , "A0" ); 14 | 15 | t.update({k:2},{$set:{v:"two v2"}},false,true) 16 | 17 | assert.eq( 0 , t.count({k:2,v:"v2"} ) , "A1" ); 18 | assert.eq( 84 , t.count({k:2,v:"two v2"} ) , "A2" ); 19 | -------------------------------------------------------------------------------- /src/third_party/libstemmer_c/src_c/stem_ISO_8859_1_portuguese.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file was generated automatically by the Snowball to ANSI C compiler */ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern struct SN_env * portuguese_ISO_8859_1_create_env(void); 9 | extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); 10 | 11 | extern int portuguese_ISO_8859_1_stem(struct SN_env * z); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /jstests/indexv.js: -------------------------------------------------------------------------------- 1 | // Check null key generation. 2 | 3 | t = db.jstests_indexv; 4 | t.drop(); 5 | 6 | t.ensureIndex( {'a.b':1} ); 7 | 8 | t.save( {a:[{},{b:1}]} ); 9 | var e = t.find( {'a.b':null} ).explain(); 10 | assert.eq( 1, e.n ); 11 | assert.eq( 1, e.nscanned ); 12 | 13 | t.drop(); 14 | t.ensureIndex( {'a.b.c':1} ); 15 | t.save( {a:[{b:[]},{b:{c:1}}]} ); 16 | var e = t.find( {'a.b.c':null} ).explain(); 17 | assert.eq( 0, e.n ); 18 | assert.eq( 1, e.nscanned ); 19 | -------------------------------------------------------------------------------- /src/mongo/db/db.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | ///////////////////////////////////////////////////////////////////////////// 6 | // 7 | // Icon 8 | // 9 | // Icon with lowest ID value placed first to ensure application icon 10 | // remains consistent on all systems. 11 | IDI_ICON2 ICON "mongo.ico" 12 | ///////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /jstests/eval4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval4; 3 | t.drop(); 4 | 5 | t.save( { a : 1 } ); 6 | t.save( { a : 2 } ); 7 | t.save( { a : 3 } ); 8 | 9 | assert.eq( 3 , t.count() , "A" ); 10 | 11 | function f( x ){ 12 | db.eval4.remove( { a : x } ); 13 | } 14 | 15 | f( 2 ); 16 | assert.eq( 2 , t.count() , "B" ); 17 | 18 | db.eval( f , 2 ); 19 | assert.eq( 2 , t.count() , "C" ); 20 | 21 | db.eval( f , 3 ); 22 | assert.eq( 1 , t.count() , "D" ); 23 | 24 | -------------------------------------------------------------------------------- /jstests/update_arraymatch1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_arraymatch1 3 | t.drop(); 4 | 5 | o = { _id : 1 , a : [ { x : 1 , y : 1 } , { x : 2 , y : 2 } , { x : 3 , y : 3 } ] } 6 | t.insert( o ); 7 | assert.eq( o , t.findOne() , "A1" ); 8 | 9 | q = { "a.x" : 2 } 10 | t.update( q , { $set : { b : 5 } } ) 11 | o.b = 5 12 | assert.eq( o , t.findOne() , "A2" ) 13 | 14 | t.update( { "a.x" : 2 } , { $inc : { "a.$.y" : 1 } } ) 15 | o.a[1].y++; 16 | assert.eq( o , t.findOne() , "A3" ); 17 | -------------------------------------------------------------------------------- /jstests/sortj.js: -------------------------------------------------------------------------------- 1 | // Test an in memory sort memory assertion after a plan has "taken over" in the query optimizer 2 | // cursor. 3 | 4 | t = db.jstests_sortj; 5 | t.drop(); 6 | 7 | t.ensureIndex( { a:1 } ); 8 | 9 | big = new Array( 100000 ).toString(); 10 | for( i = 0; i < 1000; ++i ) { 11 | t.save( { a:1, b:big } ); 12 | } 13 | 14 | assert.throws( function() { 15 | t.find( { a:{ $gte:0 }, c:null } ).sort( { d:1 } ).itcount(); 16 | } ); 17 | t.drop(); -------------------------------------------------------------------------------- /jstests/type2.js: -------------------------------------------------------------------------------- 1 | // SERVER-1735 $type:10 matches null value, not missing value. 2 | 3 | t = db.jstests_type2; 4 | t.drop(); 5 | 6 | t.save( {a:null} ); 7 | t.save( {} ); 8 | t.save( {a:'a'} ); 9 | 10 | function test() { 11 | assert.eq( 2, t.count( {a:null} ) ); 12 | assert.eq( 1, t.count( {a:{$type:10}} ) ); 13 | assert.eq( 2, t.count( {a:{$exists:true}} ) ); 14 | assert.eq( 1, t.count( {a:{$exists:false}} ) ); 15 | } 16 | 17 | test(); 18 | t.ensureIndex( {a:1} ); 19 | test(); -------------------------------------------------------------------------------- /jstests/capped.js: -------------------------------------------------------------------------------- 1 | db.jstests_capped.drop(); 2 | db.createCollection("jstests_capped", {capped:true, size:30000}); 3 | 4 | assert.eq( 1, db.system.indexes.find( {ns:"test.jstests_capped"} ).count(), "expected a count of one index for new capped collection" ); 5 | t = db.jstests_capped; 6 | 7 | t.save({x:1}); 8 | t.save({x:2}); 9 | 10 | assert( t.find().sort({$natural:1})[0].x == 1 , "expected obj.x==1"); 11 | assert( t.find().sort({$natural:-1})[0].x == 2, "expected obj.x == 2"); 12 | -------------------------------------------------------------------------------- /jstests/upsert1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.upsert1; 3 | t.drop(); 4 | 5 | t.update( { x : 1 } , { $inc : { y : 1 } } , true ); 6 | l = db.getLastErrorCmd(); 7 | assert( l.upserted , "A1" ); 8 | assert.eq( l.upserted.str , t.findOne()._id.str , "A2" ); 9 | 10 | t.update( { x : 2 } , { x : 2 , y : 3 } , true ); 11 | l = db.getLastErrorCmd(); 12 | assert( l.upserted , "B1" ); 13 | assert.eq( l.upserted.str , t.findOne( { x : 2 } )._id.str , "B2" ); 14 | assert.eq( 2 , t.find().count() , "B3" ); 15 | -------------------------------------------------------------------------------- /jstests/cursor1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.cursor1 3 | t.drop(); 4 | 5 | big = ""; 6 | while ( big.length < 50000 ) 7 | big += "asdasdasdasdsdsdadsasdasdasD"; 8 | 9 | num = Math.ceil( 10000000 / big.length ); 10 | 11 | for ( var i=0; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | MONGO_USE_SRW_ON_WINDOWS;%(PreprocessorDefinitions) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /jstests/aggregation/extras/debug.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | JavaScript Debugger Page 4 | 5 | 6 | 7 | 8 | 9 |

JavaScript Debugger page

10 | 11 | 12 |
13 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /jstests/arrayfind3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.arrayfind3; 3 | t.drop() 4 | 5 | t.save({a:[1,2]}) 6 | t.save({a:[1, 2, 6]}) 7 | t.save({a:[1, 4, 6]}) 8 | 9 | 10 | assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "A1" ) 11 | assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "A2" ) 12 | 13 | t.ensureIndex( { a : 1 } ) 14 | 15 | assert.eq( 2 , t.find( {a:{$gte:3, $lte: 5}} ).itcount() , "B1" ); 16 | assert.eq( 1 , t.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ).itcount() , "B2" ) 17 | -------------------------------------------------------------------------------- /jstests/inc3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.inc3; 3 | 4 | t.drop(); 5 | t.save( { _id : 1 , z : 1 , a : 1 } ); 6 | t.update( {} , { $inc : { z : 1 , a : 1 } } ); 7 | t.update( {} , { $inc : { a : 1 , z : 1 } } ); 8 | assert.eq( { _id : 1 , z : 3 , a : 3 } , t.findOne() , "A" ) 9 | 10 | 11 | t.drop(); 12 | t.save( { _id : 1 , a : 1 , z : 1 } ); 13 | t.update( {} , { $inc : { z : 1 , a : 1 } } ); 14 | t.update( {} , { $inc : { a : 1 , z : 1 } } ); 15 | assert.eq( { _id : 1 , a : 3 , z : 3 } , t.findOne() , "B" ) 16 | 17 | -------------------------------------------------------------------------------- /jstests/regexa.js: -------------------------------------------------------------------------------- 1 | // Test simple regex optimization with a regex | (bar) present - SERVER-3298 2 | 3 | t = db.jstests_regexa; 4 | t.drop(); 5 | 6 | function check() { 7 | assert.eq( 1, t.count( {a:/^(z|.)/} ) ); 8 | assert.eq( 1, t.count( {a:/^z|./} ) ); 9 | assert.eq( 0, t.count( {a:/^z(z|.)/} ) ); 10 | assert.eq( 1, t.count( {a:/^zz|./} ) ); 11 | } 12 | 13 | t.save( {a:'a'} ); 14 | 15 | check(); 16 | t.ensureIndex( {a:1} ); 17 | if ( 1 ) { // SERVER-3298 18 | check(); 19 | } 20 | -------------------------------------------------------------------------------- /jstests/update_arraymatch4.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_arraymatch4 3 | t.drop() 4 | 5 | x = { _id : 1 , arr : ["A1","B1","C1"] } 6 | t.insert( x ) 7 | assert.eq( x , t.findOne() , "A1" ) 8 | 9 | x.arr[0] = "A2" 10 | t.update( { arr : "A1" } , { $set : { "arr.$" : "A2" } } ) 11 | assert.eq( x , t.findOne() , "A2" ) 12 | 13 | t.ensureIndex( { arr : 1 } ) 14 | x.arr[0] = "A3" 15 | t.update( { arr : "A2" } , { $set : { "arr.$" : "A3" } } ) 16 | assert.eq( x , t.findOne() , "A3" ); // SERVER-1055 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v2/test/msvc/common.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/example/test/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright Beman Dawes, 2010 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # See www.boost.org/LICENSE_1_0.txt 6 | 7 | cp ../tut1.cpp . 8 | cp ../tut2.cpp . 9 | cp ../tut3.cpp . 10 | cp ../tut4.cpp . 11 | cp ../tut5.cpp . 12 | cp ../path_info.cpp . 13 | rm tut1 2>~/junk 14 | rm tut2 2>~/junk 15 | rm tut3 2>~/junk 16 | rm tut4 2>~/junk 17 | rm tut5 2>~/junk 18 | rm path_info 2>~/junk 19 | 20 | -------------------------------------------------------------------------------- /jstests/auth_copydb2.js: -------------------------------------------------------------------------------- 1 | a = db.getSisterDB( "copydb2-test-a" ); 2 | b = db.getSisterDB( "copydb2-test-b" ); 3 | 4 | a.dropDatabase(); 5 | b.dropDatabase(); 6 | 7 | a.foo.save( { a : 1 } ); 8 | 9 | a.addUser( "chevy" , "chase", false, 1 ); 10 | 11 | assert.eq( 1 , a.foo.count() , "A" ); 12 | assert.eq( 0 , b.foo.count() , "B" ); 13 | 14 | // SERVER-727 15 | a.copyDatabase( a._name , b._name, "" , "chevy" , "chase" ); 16 | assert.eq( 1 , a.foo.count() , "C" ); 17 | assert.eq( 1 , b.foo.count() , "D" ); 18 | -------------------------------------------------------------------------------- /jstests/geo_poly_line.js: -------------------------------------------------------------------------------- 1 | // Test that weird polygons work SERVER-3725 2 | 3 | t = db.geo_polygon5; 4 | t.drop(); 5 | 6 | t.insert({loc:[0,0]}) 7 | t.insert({loc:[1,0]}) 8 | t.insert({loc:[2,0]}) 9 | t.insert({loc:[3,0]}) 10 | t.insert({loc:[4,0]}) 11 | 12 | t.ensureIndex( { loc : "2d" } ); 13 | 14 | printjson( t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).toArray() ) 15 | 16 | assert.eq( 5, t.find({ loc: { "$within": { "$polygon" : [[0,0], [2,0], [4,0]] } } }).itcount() ) 17 | 18 | -------------------------------------------------------------------------------- /jstests/geof.js: -------------------------------------------------------------------------------- 1 | t = db.geof 2 | t.drop(); 3 | 4 | // corners (dist ~0.98) 5 | t.insert({loc: [ 0.7, 0.7]}) 6 | t.insert({loc: [ 0.7, -0.7]}) 7 | t.insert({loc: [-0.7, 0.7]}) 8 | t.insert({loc: [-0.7, -0.7]}) 9 | 10 | // on x axis (dist == 0.9) 11 | t.insert({loc: [-0.9, 0]}) 12 | t.insert({loc: [-0.9, 0]}) 13 | 14 | t.ensureIndex( { loc : "2d" } ) 15 | 16 | t.find({loc: {$near: [0,0]}}).limit(2).forEach( function(o){ 17 | //printjson(o); 18 | assert.lt(Geo.distance([0,0], o.loc), 0.95); 19 | }); 20 | -------------------------------------------------------------------------------- /jstests/repl/block1.js: -------------------------------------------------------------------------------- 1 | 2 | var rt = new ReplTest( "block1" ); 3 | 4 | m = rt.start( true ); 5 | s = rt.start( false ); 6 | 7 | dbm = m.getDB( "foo" ); 8 | dbs = s.getDB( "foo" ); 9 | 10 | tm = dbm.bar; 11 | ts = dbs.bar; 12 | 13 | for ( var i=0; i<1000; i++ ){ 14 | tm.insert( { _id : i } ); 15 | dbm.runCommand( { getlasterror : 1 , w : 2 } ) 16 | assert.eq( i + 1 , ts.count() , "A" + i ); 17 | assert.eq( i + 1 , tm.count() , "B" + i ); 18 | } 19 | 20 | rt.stop(); 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /jstests/server9385.js: -------------------------------------------------------------------------------- 1 | // SERVER-9385 ensure saving a document derived from bson->js conversion doesn't lose it's _id 2 | t = db.server9385; 3 | t.drop(); 4 | 5 | t.insert( { _id : 1, x : 1 } ); 6 | x = t.findOne(); 7 | x._id = 2; 8 | t.save( x ); 9 | 10 | t.find().forEach( printjson ); 11 | 12 | assert.eq( 2, t.find().count() ); 13 | assert.eq( 2, t.find().itcount() ); 14 | 15 | assert( t.findOne( { _id : 1 } ), "original insert missing" ); 16 | assert( t.findOne( { _id : 2 } ), "save didn't work?" ); 17 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/thread/condition.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_THREAD_CONDITION_HPP 2 | #define BOOST_THREAD_CONDITION_HPP 3 | // (C) Copyright 2007 Anthony Williams 4 | // 5 | // Distributed under the Boost Software License, Version 1.0. (See 6 | // accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | typedef condition_variable_any condition; 14 | } 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6275.js: -------------------------------------------------------------------------------- 1 | // confirm that undefined no longer counts as 0 in $avg 2 | c = db.c; 3 | c.drop(); 4 | c.save({a:1}); 5 | c.save({a:4}); 6 | c.save({b:1}); 7 | assert.eq(c.aggregate({$group:{_id: null, avg:{$avg:"$a"}}}).result[0].avg, 2.5); 8 | 9 | // again ensuring numberLongs work properly 10 | c.drop(); 11 | c.save({a:NumberLong(1)}); 12 | c.save({a:NumberLong(4)}); 13 | c.save({b:NumberLong(1)}); 14 | assert.eq(c.aggregate({$group:{_id: null, avg:{$avg:"$a"}}}).result[0].avg, 2.5); 15 | -------------------------------------------------------------------------------- /jstests/aggregation/disabled/server5369.js: -------------------------------------------------------------------------------- 1 | // https://jira.mongodb.org/browse/SERVER-5369 2 | // make sure excluding a field doesnt cause _id to appear twice 3 | 4 | // use the aggregation test db 5 | db = db.getSiblingDB('aggdb'); 6 | 7 | // empty and populate 8 | db.test.drop(); 9 | db.test.save({a:1,b:2}) 10 | 11 | // agg with exclusion than ensure fields are only the two we expect 12 | var f = db.test.aggregate({$project:{a:0}}); 13 | assert.eq(["_id","b"], Object.keySet(f.result[0]), "server5369 failed"); 14 | -------------------------------------------------------------------------------- /jstests/countb.js: -------------------------------------------------------------------------------- 1 | // Test fast count mode with single key index unsatisfiable constraints on a multi key index. 2 | 3 | t = db.jstests_countb; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1} ); 7 | t.save( {a:['a','b']} ); 8 | assert.eq( 0, t.find( {a:{$in:['a'],$gt:'b'}} ).count() ); 9 | assert.eq( 0, t.find( {$and:[{a:'a'},{a:{$gt:'b'}}]} ).count() ); 10 | assert.eq( 1, t.find( {$and:[{a:'a'},{$where:"this.a[1]=='b'"}]} ).count() ); 11 | assert.eq( 0, t.find( {$and:[{a:'a'},{$where:"this.a[1]!='b'"}]} ).count() ); 12 | -------------------------------------------------------------------------------- /jstests/geo_box2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.geo_box2; 3 | 4 | t.drop() 5 | 6 | for (i=1; i<10; i++) { 7 | for(j=1; j<10; j++) { 8 | t.insert({loc : [i,j]}); 9 | } 10 | } 11 | 12 | t.ensureIndex({"loc" : "2d"} ) 13 | assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "A1" ); 14 | 15 | t.dropIndex( { "loc" : "2d" } ) 16 | 17 | t.ensureIndex({"loc" : "2d"} , {"min" : 0, "max" : 10}) 18 | assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "B1" ); 19 | 20 | -------------------------------------------------------------------------------- /jstests/geod.js: -------------------------------------------------------------------------------- 1 | var t=db.geod; 2 | t.drop() 3 | t.save( { loc: [0,0] } ) 4 | t.save( { loc: [0.5,0] } ) 5 | t.ensureIndex({loc:"2d"}) 6 | // do a few geoNears with different maxDistances. The first iteration 7 | // should match no points in the dataset. 8 | dists = [.49, .51, 1.0] 9 | for (idx in dists){ 10 | b=db.runCommand({geoNear:"geod", near:[1,0], num:2, maxDistance:dists[idx]}); 11 | assert.eq(b.errmsg, undefined, "A"+idx); 12 | l=b.results.length 13 | assert.eq(l, idx, "B"+idx) 14 | } 15 | -------------------------------------------------------------------------------- /jstests/ne3.js: -------------------------------------------------------------------------------- 1 | // don't allow most operators with regex 2 | 3 | t = db.jstests_ne3; 4 | t.drop(); 5 | 6 | assert.throws( function() { t.findOne( { t: { $ne: /a/ } } ); } ); 7 | assert.throws( function() { t.findOne( { t: { $gt: /a/ } } ); } ); 8 | assert.throws( function() { t.findOne( { t: { $gte: /a/ } } ); } ); 9 | assert.throws( function() { t.findOne( { t: { $lt: /a/ } } ); } ); 10 | assert.throws( function() { t.findOne( { t: { $lte: /a/ } } ); } ); 11 | 12 | assert.eq( 0, t.count( { t: { $in: [ /a/ ] } } ) ); -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6468.js: -------------------------------------------------------------------------------- 1 | // SERVER-6468 nested and dotted projections should be treated the same 2 | c = db.c; 3 | c.drop(); 4 | 5 | c.save( { a:'foo', b:{ c:'bar', z:'not there' } } ); 6 | 7 | function test(projection) { 8 | res = c.aggregate({$project: projection}) 9 | assert.eq(res.result[0], {b: {c: 'bar'}}); 10 | } 11 | 12 | // These should all mean the same thing 13 | test({_id:0, 'b.c':1}) 14 | test({_id:0, 'b.c':'$b.c'}) 15 | test({_id:0, b: {c:1}}) 16 | test({_id:0, b: {c:'$b.c'}}) 17 | -------------------------------------------------------------------------------- /jstests/geo_withinquery.js: -------------------------------------------------------------------------------- 1 | // SERVER-7343: allow $within without a geo index. 2 | t = db.geo_withinquery; 3 | t.drop(); 4 | 5 | num = 0; 6 | for ( x=0; x<=20; x++ ){ 7 | for ( y=0; y<=20; y++ ){ 8 | o = { _id : num++ , loc : [ x , y ] } 9 | t.save( o ) 10 | } 11 | } 12 | 13 | assert.eq(21 * 21 - 1, t.find({ $and: [ {loc: {$ne:[0,0]}}, 14 | {loc: {$within: {$box: [[0,0], [100,100]]}}}, 15 | ]}).itcount(), "UHOH!") 16 | -------------------------------------------------------------------------------- /jstests/objid6.js: -------------------------------------------------------------------------------- 1 | o = new ObjectId(); 2 | assert(o.getTimestamp); 3 | 4 | a = new ObjectId("4c17f616a707427266a2801a"); 5 | b = new ObjectId("4c17f616a707428966a2801c"); 6 | assert.eq(a.getTimestamp(), b.getTimestamp() , "A" ); 7 | 8 | x = Math.floor( (new Date()).getTime() / 1000 ); 9 | sleep(10/*ms*/) 10 | a = new ObjectId(); 11 | sleep(10/*ms*/) 12 | z = Math.floor( (new Date()).getTime() / 1000 ); 13 | y = a.getTimestamp().getTime() / 1000; 14 | 15 | assert.lte( x , y , "B" ); 16 | assert.lte( y , z , "C" ); 17 | -------------------------------------------------------------------------------- /jstests/orh.js: -------------------------------------------------------------------------------- 1 | // SERVER-2831 Demonstration of sparse index matching semantics in a multi index $or query. 2 | 3 | t = db.jstests_orh; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1}, {sparse:true} ); 7 | t.ensureIndex( {b:1,a:1} ); 8 | 9 | t.remove(); 10 | t.save( {b:2} ); 11 | assert.eq( 1, t.count( {a:null} ) ); 12 | assert.eq( 1, t.count( {b:2,a:null} ) ); 13 | 14 | assert.eq( 1, t.count( {$or:[{b:2,a:null},{a:null}]} ) ); 15 | 16 | // Is this desired? 17 | assert.eq( 1, t.count( {$or:[{a:null},{b:2,a:null}]} ) ); 18 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function0.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 0 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function1.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 1 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function10.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 10 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function2.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 2 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function3.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 3 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function4.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 4 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function5.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 5 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function6.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 6 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function7.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 7 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function8.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 8 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/function/function9.hpp: -------------------------------------------------------------------------------- 1 | // Boost.Function library 2 | 3 | // Copyright Douglas Gregor 2002-2003. Use, modification and 4 | // distribution is subject to the Boost Software License, Version 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 | // http://www.boost.org/LICENSE_1_0.txt) 7 | 8 | // For more information, see http://www.boost.org 9 | 10 | #define BOOST_FUNCTION_NUM_ARGS 9 11 | #include 12 | #undef BOOST_FUNCTION_NUM_ARGS 13 | -------------------------------------------------------------------------------- /src/third_party/s2/util/math/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env windows linux darwin solaris") 4 | 5 | env = env.Clone() 6 | 7 | env.Append(CCFLAGS=['-Isrc/third_party/s2']) 8 | env.Append(CCFLAGS=['-Isrc/third_party/gflags-2.0/src']) 9 | 10 | if solaris: 11 | # Enables declaration of isinf() on Solaris 12 | env.Append(CPPDEFINES=['__C99FEATURES__']) 13 | 14 | env.StaticLibrary("math", 15 | [ "mathutil.cc", 16 | # "mathlimits.cc", 17 | ]) 18 | -------------------------------------------------------------------------------- /src/third_party/v8/ChangeLog_10gen: -------------------------------------------------------------------------------- 1 | 10gen v8 changelog 2 | ------------------ 3 | 4 | 12/19/12: 5 | - SERVER-7990: Use real_climit() in StackLimitCheck::HasOverflowed (backport of chromium cr 11362007) 6 | 7 | 12/18/12: 8 | - SERVER-7989: Fixed issue with ContextSwitcher::PreemptionReceived always checking the default isolate 9 | 10 | 10/25/12: 11 | - SERVER-2407: 12 | - Retrieved base version of v8: 3.12.19.11 via git 13 | - Removed files unused by mongodb 14 | - SCons integration 15 | -------------------------------------------------------------------------------- /jstests/basic1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.getCollection( "basic1" ); 3 | t.drop(); 4 | 5 | o = { a : 1 }; 6 | t.save( o ); 7 | 8 | assert.eq( 1 , t.findOne().a , "first" ); 9 | assert( o._id , "now had id" ); 10 | assert( o._id.str , "id not a real id" ); 11 | 12 | o.a = 2; 13 | t.save( o ); 14 | 15 | assert.eq( 2 , t.findOne().a , "second" ); 16 | 17 | assert(t.validate().valid); 18 | 19 | // not a very good test of currentOp, but tests that it at least 20 | // is sort of there: 21 | assert( db.currentOp().inprog != null ); 22 | -------------------------------------------------------------------------------- /jstests/find_and_modify_server6582.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.find_and_modify_server6582; 3 | 4 | t.drop(); 5 | x = t.runCommand( "findAndModify" , {query:{f:1}, update:{$set:{f:2}}, upsert:true, new:true}) 6 | le = x.lastErrorObject 7 | assert.eq( le.updatedExisting, false ) 8 | assert.eq( le.n, 1 ) 9 | assert.eq( le.upserted, x.value._id ) 10 | 11 | t.drop(); 12 | t.insert( { f : 1 } ) 13 | x = t.runCommand( "findAndModify" , {query:{f:1}, remove : true } ) 14 | le = x.lastErrorObject 15 | assert.eq( le.n, 1 ) 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /jstests/geo7.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.geo7; 3 | t.drop(); 4 | 5 | t.insert({_id:1,y:[1,1]}) 6 | t.insert({_id:2,y:[1,1],z:3}) 7 | t.insert({_id:3,y:[1,1],z:4}) 8 | t.insert({_id:4,y:[1,1],z:5}) 9 | 10 | t.ensureIndex({y:"2d",z:1}) 11 | 12 | assert.eq( 1 , t.find({y:[1,1],z:3}).itcount() , "A1" ); 13 | 14 | t.dropIndex({y:"2d",z:1}) 15 | 16 | t.ensureIndex({y:"2d"}) 17 | assert.eq( 1 , t.find({y:[1,1],z:3}).itcount() , "A2" ); 18 | 19 | t.insert( { _id : 5 , y : 5 } ); 20 | assert.eq( 5 , t.findOne( { y : 5 } )._id , "B1" ); 21 | -------------------------------------------------------------------------------- /jstests/ismaster.js: -------------------------------------------------------------------------------- 1 | var res = db.isMaster(); 2 | assert( res.maxBsonObjectSize && 3 | isNumber(res.maxBsonObjectSize) && 4 | res.maxBsonObjectSize > 0, "maxBsonObjectSize possibly missing:" + tojson(res)) 5 | assert( res.maxMessageSizeBytes && 6 | isNumber(res.maxMessageSizeBytes) && 7 | res.maxBsonObjectSize > 0, "maxMessageSizeBytes possibly missing:" + tojson(res)) 8 | assert(res.ismaster, "ismaster missing or false:" + tojson(res)) 9 | assert(res.localTime, "localTime possibly missing:" + tojson(res)) -------------------------------------------------------------------------------- /jstests/tool/data/csvimport1.csv: -------------------------------------------------------------------------------- 1 | a,b,c 2 | 1,"this is some text. 3 | This text spans multiple lines, and just for fun 4 | contains a comma", "This has leading and trailing whitespace!" 5 | 2, "When someone says something you ""put it in quotes""", I like embedded quotes/slashes\backslashes 6 | 3 , " This line contains the empty string and has leading and trailing whitespace inside the quotes! ", "" 7 | "4" ,, How are empty entries handled? 8 | "5","""""", """This string is in quotes and contains empty quotes ("""")""" 9 | -------------------------------------------------------------------------------- /jstests/geo_regex0.js: -------------------------------------------------------------------------------- 1 | // From SERVER-2247 2 | // Tests to make sure regex works with geo indices 3 | 4 | t = db.regex0 5 | t.drop() 6 | 7 | t.ensureIndex( { point : '2d', words : 1 } ) 8 | t.insert( { point : [ 1, 1 ], words : [ 'foo', 'bar' ] } ) 9 | 10 | regex = { words : /^f/ } 11 | geo = { point : { $near : [ 1, 1 ] } } 12 | both = { point : { $near : [ 1, 1 ] }, words : /^f/ } 13 | 14 | assert.eq(1, t.find( regex ).count() ) 15 | assert.eq(1, t.find( geo ).count() ) 16 | assert.eq(1, t.find( both ).count() ) 17 | 18 | 19 | -------------------------------------------------------------------------------- /jstests/indexz.js: -------------------------------------------------------------------------------- 1 | // Check that optimal query plans do not contain empty but unindexed ranges. 2 | 3 | t = db.jstests_indexz; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1} ); 7 | t.ensureIndex( {a:1,b:1} ); 8 | 9 | t.save( {a:1,b:[1,3]} ); 10 | 11 | // The plan for single key index {a:1} is not marked optimal because a constraint exists on field 12 | // {b:1}. 13 | explain = t.find( {a:1,b:{$gt:2,$lt:2}} ).explain(true); 14 | assert.eq( 'BtreeCursor a_1_b_1', explain.cursor ); 15 | assert.eq( 1, explain.allPlans.length ); 16 | 17 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6232.js: -------------------------------------------------------------------------------- 1 | // SERVER-6232: seg fault when providing an empty object as an expression argument in agg 2 | // clear and populated db 3 | db.s6232.drop(); 4 | db.s6232.save({}); 5 | 6 | // case where an empty object is evaluated 7 | result = db.s6232.aggregate({$project: {a: {$and: [{}]}}}); 8 | assert.eq(result.result[0].a, true); 9 | 10 | // case where result should contain a new empty object 11 | result = db.s6232.aggregate({$project: {a: {$ifNull: ['$b', {}]}}}); 12 | assert.eq(result.result[0].a, {}); 13 | -------------------------------------------------------------------------------- /jstests/geo_distinct.js: -------------------------------------------------------------------------------- 1 | // Test distinct with geo queries SERVER-2135 2 | 3 | t = db.commits 4 | t.drop() 5 | 6 | t.save( { _id : ObjectId( "4ce63ec2f360622431000013" ), loc : [ 55.59664, 13.00156 ], author : "FredrikL" } ) 7 | 8 | printjson( db.runCommand( { distinct : 'commits', key : 'loc' } ) ) 9 | assert.isnull( db.getLastError() ) 10 | 11 | t.ensureIndex( { loc : '2d' } ) 12 | 13 | printjson( t.getIndexes() ) 14 | 15 | printjson( db.runCommand( { distinct : 'commits', key : 'loc' } ) ) 16 | assert.isnull( db.getLastError() ) -------------------------------------------------------------------------------- /jstests/set2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set2; 3 | t.drop(); 4 | 5 | t.save( { _id : 1 , x : true , y : { x : true } } ); 6 | assert.eq( true , t.findOne().x ); 7 | 8 | t.update( { _id : 1 } , { $set : { x : 17 } } ); 9 | assert.eq( 17 , t.findOne().x ); 10 | 11 | assert.eq( true , t.findOne().y.x ); 12 | t.update( { _id : 1 } , { $set : { "y.x" : 17 } } ); 13 | assert.eq( 17 , t.findOne().y.x ); 14 | 15 | t.update( { _id : 1 } , { $set : { a : 2 , b : 3 } } ); 16 | assert.eq( 2 , t.findOne().a ); 17 | assert.eq( 3 , t.findOne().b ); 18 | 19 | -------------------------------------------------------------------------------- /jstests/update9.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update9; 3 | t.drop() 4 | 5 | orig = { "_id" : 1 , 6 | "question" : "a", 7 | "choices" : { "1" : { "choice" : "b" }, 8 | "0" : { "choice" : "c" } } , 9 | 10 | } 11 | 12 | t.save( orig ); 13 | assert.eq( orig , t.findOne() , "A" ); 14 | 15 | t.update({_id: 1, 'choices.0.votes': {$ne: 1}}, {$push: {'choices.0.votes': 1}}) 16 | 17 | orig.choices["0"].votes = [ 1 ] ; 18 | assert.eq( orig.choices["0"] , t.findOne().choices["0"] , "B" ); 19 | 20 | -------------------------------------------------------------------------------- /standalone/Trip.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRIPS_HPP 2 | #define TRIPS_HPP 3 | 4 | #include 5 | #include 6 | 7 | 8 | //struct Trip { 9 | // // last attribute is the index 10 | // // So should be size + 1 11 | // uint64_t * attributes; 12 | //}; 13 | 14 | //struct TripKey { 15 | // uint64_t * attributes; 16 | //}; 17 | 18 | typedef uint64_t Trip; 19 | typedef uint64_t TripKey; 20 | 21 | typedef std::vector TripVector; 22 | //typedef boost::unordered_set TripSet; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /jstests/basic9.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.getCollection( "foo_basic9" ); 3 | 4 | t.save( { "foo$bar" : 5 } ); 5 | 6 | ok = false; 7 | 8 | try{ 9 | t.save( { "$foo" : 5 } ); 10 | ok = false; 11 | } 12 | catch ( e ){ 13 | ok = true; 14 | } 15 | assert( ok , "key names aren't allowed to start with $ doesn't work" ); 16 | 17 | try{ 18 | t.save( { "x" : { "$foo" : 5 } } ); 19 | ok = false; 20 | } 21 | catch ( e ){ 22 | ok = true; 23 | } 24 | assert( ok , "embedded key names aren't allowed to start with $ doesn't work" ); 25 | 26 | -------------------------------------------------------------------------------- /jstests/fts_partition_no_multikey.js: -------------------------------------------------------------------------------- 1 | 2 | load( "jstests/libs/fts.js" ); 3 | 4 | t = db.fts_partition_no_multikey; 5 | t.drop(); 6 | 7 | t.ensureIndex( { x : 1, y : "text" } ) 8 | 9 | t.insert( { x : 5 , y : "this is fun" } ); 10 | assert.isnull( db.getLastError() ); 11 | 12 | t.insert( { x : [] , y : "this is fun" } ); 13 | assert( db.getLastError() ); 14 | 15 | t.insert( { x : [1] , y : "this is fun" } ); 16 | assert( db.getLastError() ); 17 | 18 | t.insert( { x : [1,2] , y : "this is fun" } ); 19 | assert( db.getLastError() ); 20 | -------------------------------------------------------------------------------- /src/mongo/db/kdtree/Trip.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRIPS_HPP 2 | #define TRIPS_HPP 3 | 4 | #include 5 | #include 6 | 7 | 8 | //struct Trip { 9 | // // last attribute is the index 10 | // // So should be size + 1 11 | // uint64_t * attributes; 12 | //}; 13 | 14 | //struct TripKey { 15 | // uint64_t * attributes; 16 | //}; 17 | 18 | typedef uint64_t Trip; 19 | typedef uint64_t TripKey; 20 | 21 | typedef std::vector TripVector; 22 | //typedef boost::unordered_set TripSet; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /jstests/parallel/checkMultiThread.js: -------------------------------------------------------------------------------- 1 | 2 | var start = new Date(); 3 | print("start: " + start); 4 | var func = function() { db.runCommand({$eval: "sleep(10000);", nolock: true}); return new Date();} 5 | a = new ScopedThread( func ); 6 | b = new ScopedThread( func ); 7 | a.start(); 8 | b.start(); 9 | a.join(); 10 | b.join(); 11 | assert.lt( a.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "A took more than 15s" ); 12 | assert.lt( b.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "B took more than 15s" ); 13 | 14 | -------------------------------------------------------------------------------- /jstests/updated.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.updated; 3 | t.drop() 4 | 5 | o = { _id : Math.random() , 6 | items:[null,null,null,null] 7 | }; 8 | 9 | t.insert( o ); 10 | assert.eq( o , t.findOne() , "A1" ); 11 | 12 | o.items[0] = {amount:9000,itemId:1}; 13 | t.update({},{$set:{"items.0":o.items[0]}}); 14 | assert.eq( o , t.findOne() , "A2" ); 15 | 16 | o.items[0].amount += 1000; 17 | o.items[1] = {amount:1,itemId:2}; 18 | t.update({},{$inc:{"items.0.amount":1000},$set:{"items.1":o.items[1]}}); 19 | assert.eq( o , t.findOne() , "A3" ); 20 | 21 | -------------------------------------------------------------------------------- /jstests/geo_sort1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.geo_sort1 3 | t.drop(); 4 | 5 | for ( x=0; x<10; x++ ){ 6 | for ( y=0; y<10; y++ ){ 7 | t.insert( { loc : [ x , y ] , foo : x * x * y } ); 8 | } 9 | } 10 | 11 | t.ensureIndex( { loc : "2d" , foo : 1 } ) 12 | 13 | q = t.find( { loc : { $near : [ 5 , 5 ] } , foo : { $gt : 20 } } ) 14 | m = function(z){ return z.foo; } 15 | 16 | a = q.clone().map( m ); 17 | b = q.clone().sort( { foo : 1 } ).map( m ); 18 | 19 | assert.neq( a , b , "A" ); 20 | a.sort(); 21 | b.sort(); 22 | assert.eq( a , b , "B" ); 23 | -------------------------------------------------------------------------------- /jstests/ref.js: -------------------------------------------------------------------------------- 1 | // to run: 2 | // ./mongo jstests/ref.js 3 | 4 | db.otherthings.drop(); 5 | db.things.drop(); 6 | 7 | var other = { s : "other thing", n : 1}; 8 | db.otherthings.save(other); 9 | 10 | db.things.save( { name : "abc" } ); 11 | x = db.things.findOne(); 12 | x.o = new DBPointer( "otherthings" , other._id ); 13 | db.things.save(x); 14 | 15 | assert( db.things.findOne().o.fetch().n == 1, "dbref broken 2" ); 16 | 17 | other.n++; 18 | db.otherthings.save(other); 19 | assert( db.things.findOne().o.fetch().n == 2, "dbrefs broken" ); 20 | -------------------------------------------------------------------------------- /jstests/set6.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.set6; 3 | t.drop(); 4 | 5 | x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) } 6 | t.insert( x ) 7 | assert.eq( x , t.findOne() , "A" ); 8 | 9 | x.r.$id = new ObjectId() 10 | t.update({}, { $set : { r : x.r } } ); 11 | assert.eq( x , t.findOne() , "B"); 12 | 13 | x.r2 = new DBRef( "foo2" , 5 ) 14 | t.update( {} , { $set : { "r2" : x.r2 } } ); 15 | assert.eq( x , t.findOne() , "C" ) 16 | 17 | x.r.$id = 2; 18 | t.update( {} , { $set : { "r.$id" : 2 } } ) 19 | assert.eq( x.r.$id , t.findOne().r.$id , "D"); 20 | 21 | -------------------------------------------------------------------------------- /jstests/sharding/hash_single_shard.js: -------------------------------------------------------------------------------- 1 | // Test hashed presplit with 1 shard. 2 | 3 | var st = new ShardingTest({ shards: 1 }); 4 | var testDB = st.getDB('test'); 5 | 6 | //create hashed shard key and enable sharding 7 | testDB.adminCommand({ enablesharding: "test" }); 8 | testDB.adminCommand({ shardCollection: "test.collection", key: { a: "hashed" }}); 9 | 10 | //check the number of initial chunks. 11 | assert.eq(2, st.getDB('config').chunks.count(), 12 | 'Using hashed shard key but failing to do correct presplitting'); 13 | st.stop(); 14 | 15 | -------------------------------------------------------------------------------- /jstests/geo5.js: -------------------------------------------------------------------------------- 1 | t = db.geo5; 2 | t.drop(); 3 | 4 | t.insert( { p : [ 0,0 ] } ) 5 | t.ensureIndex( { p : "2d" } ) 6 | 7 | res = t.runCommand( "geoNear" , { near : [1,1] } ); 8 | assert.eq( 1 , res.results.length , "A1" ); 9 | 10 | t.insert( { p : [ 1,1 ] } ) 11 | t.insert( { p : [ -1,-1 ] } ) 12 | res = t.runCommand( "geoNear" , { near : [50,50] } ); 13 | assert.eq( 3 , res.results.length , "A2" ); 14 | 15 | t.insert( { p : [ -1,-1 ] } ) 16 | res = t.runCommand( "geoNear" , { near : [50,50] } ); 17 | assert.eq( 4 , res.results.length , "A3" ); 18 | 19 | -------------------------------------------------------------------------------- /jstests/geo_s2dedupnear.js: -------------------------------------------------------------------------------- 1 | // Make sure that we don't return several of the same result due to faulty 2 | // assumptions about the btree cursor. That is, don't return duplicate results. 3 | t = db.geo_s2dedupnear 4 | t.drop() 5 | 6 | t.ensureIndex( { geo : "2dsphere" } ) 7 | var x = { "type" : "Polygon", 8 | "coordinates" : [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]} 9 | t.insert({geo: x}) 10 | res = t.find({geo: {$geoNear: {"type" : "Point", "coordinates" : [31, 41]}}}) 11 | assert.eq(res.itcount(), 1) 12 | -------------------------------------------------------------------------------- /jstests/ref3.js: -------------------------------------------------------------------------------- 1 | // to run: 2 | // ./mongo jstests/ref3.js 3 | 4 | db.otherthings3.drop(); 5 | db.things3.drop(); 6 | 7 | var other = { s : "other thing", n : 1}; 8 | db.otherthings3.save(other); 9 | 10 | db.things3.save( { name : "abc" } ); 11 | x = db.things3.findOne(); 12 | x.o = new DBRef( "otherthings3" , other._id ); 13 | db.things3.save(x); 14 | 15 | assert( db.things3.findOne().o.fetch().n == 1, "dbref broken 2" ); 16 | 17 | other.n++; 18 | db.otherthings3.save(other); 19 | assert( db.things3.findOne().o.fetch().n == 2, "dbrefs broken" ); 20 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/config/platform/amigaos.hpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright John Maddock 2002. 2 | // Use, modification and distribution are subject to the 3 | // Boost Software License, Version 1.0. (See accompanying file 4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | // See http://www.boost.org for most recent version. 7 | 8 | #define BOOST_PLATFORM "AmigaOS" 9 | 10 | #define BOOST_DISABLE_THREADS 11 | #define BOOST_NO_CWCHAR 12 | #define BOOST_NO_STD_WSTRING 13 | #define BOOST_NO_INTRINSIC_WCHAR_T 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/third_party/s2/base/int128.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2004 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // 5 | 6 | #include 7 | using std::ostream; 8 | using std::cout; 9 | using std::endl; 10 | 11 | #include "int128.h" 12 | #include "integral_types.h" 13 | 14 | const uint128 kuint128max(static_cast(GG_LONGLONG(0xFFFFFFFFFFFFFFFF)), 15 | static_cast(GG_LONGLONG(0xFFFFFFFFFFFFFFFF))); 16 | 17 | ostream& operator<<(ostream& o, const uint128& b) { 18 | return (o << b.hi_ << "::" << b.lo_); 19 | } 20 | -------------------------------------------------------------------------------- /jstests/distinct_speed1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.distinct_speed1; 3 | 4 | t.drop(); 5 | for ( var i=0; i<10000; i++ ){ 6 | t.save( { x : i % 10 } ); 7 | } 8 | 9 | assert.eq( 10 , t.distinct("x").length , "A1" ); 10 | 11 | function fast(){ 12 | t.find().explain().millis; 13 | } 14 | 15 | function slow(){ 16 | t.distinct("x"); 17 | } 18 | 19 | for ( i=0; i<3; i++ ){ 20 | print( "it: " + Date.timeFunc( fast ) ); 21 | print( "di: " + Date.timeFunc( slow ) ); 22 | } 23 | 24 | 25 | t.ensureIndex( { x : 1 } ); 26 | t.distinct( "x" , { x : 5 } ) 27 | -------------------------------------------------------------------------------- /jstests/find_and_modify2.js: -------------------------------------------------------------------------------- 1 | t = db.find_and_modify2; 2 | t.drop(); 3 | 4 | t.insert({_id:1, i:0, j:0}); 5 | 6 | out = t.findAndModify({update: {$inc: {i:1}}, 'new': true, fields: {i:1}}); 7 | assert.eq(out, {_id:1, i:1}); 8 | 9 | out = t.findAndModify({update: {$inc: {i:1}}, fields: {i:0}}); 10 | assert.eq(out, {_id:1, j:0}); 11 | 12 | out = t.findAndModify({update: {$inc: {i:1}}, fields: {_id:0, j:1}}); 13 | assert.eq(out, {j:0}); 14 | 15 | out = t.findAndModify({update: {$inc: {i:1}}, fields: {_id:0, j:1}, 'new': true}); 16 | assert.eq(out, {j:0}); 17 | -------------------------------------------------------------------------------- /jstests/slowNightly/explain2.js: -------------------------------------------------------------------------------- 1 | // Test for race condition SERVER-2807. One cursor is dropped and another is not. 2 | 3 | collName = 'jstests_slowNightly_explain2'; 4 | 5 | t = db[ collName ]; 6 | t.drop(); 7 | 8 | db.createCollection( collName, {capped:true,size:100000} ); 9 | t = db[ collName ]; 10 | t.ensureIndex( {x:1} ); 11 | 12 | a = startParallelShell( 'for( i = 0; i < 50000; ++i ) { db.' + collName + '.insert( {x:i,y:1} ); }' ); 13 | 14 | for( i = 0; i < 800; ++i ) { 15 | t.find( {x:{$gt:-1},y:1} ).sort({x:-1}).explain(); 16 | } 17 | 18 | a(); -------------------------------------------------------------------------------- /src/mongo/unittest/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python; -*- 2 | 3 | Import("env") 4 | 5 | env.StaticLibrary("unittest", ['unittest.cpp'], 6 | LIBDEPS=['$BUILD_DIR/mongo/foundation']) 7 | 8 | env.StaticLibrary("unittest_main", ['unittest_main.cpp'], 9 | LIBDEPS=['unittest', 10 | '$BUILD_DIR/mongo/base/base']) 11 | 12 | env.StaticLibrary("unittest_crutch", ['crutch.cpp']) 13 | 14 | 15 | env.CppUnitTest('unittest_test', 'unittest_test.cpp') 16 | env.CppUnitTest('fixture_test', 'fixture_test.cpp') 17 | -------------------------------------------------------------------------------- /jstests/exists7.js: -------------------------------------------------------------------------------- 1 | 2 | // Test that non boolean value types are allowed with $explain spec. SERVER-2322 3 | 4 | t = db.jstests_explain7; 5 | t.drop(); 6 | 7 | function testIntegerExistsSpec() { 8 | t.remove(); 9 | t.save( {} ); 10 | t.save( {a:1} ); 11 | t.save( {a:2} ); 12 | t.save( {a:3, b:3} ); 13 | t.save( {a:4, b:4} ); 14 | 15 | assert.eq( 2, t.count( {b:{$exists:1}} ) ); 16 | assert.eq( 3, t.count( {b:{$exists:0}} ) ); 17 | } 18 | 19 | testIntegerExistsSpec(); 20 | t.ensureIndex( {b:1} ); 21 | testIntegerExistsSpec(); 22 | -------------------------------------------------------------------------------- /jstests/slowNightly/server7428.js: -------------------------------------------------------------------------------- 1 | // Regression test for SERVER-7428. 2 | // 3 | // Verify that the copyDatabase command works appropriately when the 4 | // target mongo instance has authentication enabled. 5 | 6 | // Setup fromDb with no auth 7 | var fromDb = MongoRunner.runMongod({ port: 29000 }); 8 | 9 | // Setup toDb with auth 10 | var toDb = MongoRunner.runMongod({auth : "", port : 31001}); 11 | var admin = toDb.getDB("admin"); 12 | admin.addUser("foo","bar"); 13 | admin.auth("foo","bar"); 14 | 15 | admin.copyDatabase('test', 'test', fromDb.host) 16 | 17 | -------------------------------------------------------------------------------- /jstests/sortf.js: -------------------------------------------------------------------------------- 1 | // Unsorted plan on {a:1}, sorted plan on {b:1}. The unsorted plan exhausts its memory limit before 2 | // the sorted plan is chosen by the query optimizer. 3 | 4 | t = db.jstests_sortf; 5 | t.drop(); 6 | 7 | t.ensureIndex( {a:1} ); 8 | t.ensureIndex( {b:1} ); 9 | 10 | for( i = 0; i < 100; ++i ) { 11 | t.save( {a:0,b:0} ); 12 | } 13 | 14 | big = new Array( 10 * 1000 * 1000 ).toString(); 15 | for( i = 0; i < 5; ++i ) { 16 | t.save( {a:1,b:1,big:big} ); 17 | } 18 | 19 | assert.eq( 5, t.find( {a:1} ).sort( {b:1} ).itcount() ); 20 | t.drop(); -------------------------------------------------------------------------------- /jstests/update_multi3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.update_multi3; 3 | 4 | function test( useIndex ){ 5 | t.drop(); 6 | 7 | if ( useIndex ) 8 | t.ensureIndex({k:1}) 9 | 10 | for (i=0; i<10; i++) { 11 | t.save({ _id : i , k: 'x', a: []}); 12 | } 13 | 14 | t.update({k: 'x'}, {$push: {a: 'y'}}, false, true); 15 | 16 | t.find( { k : "x" } ).forEach( 17 | function(z){ 18 | assert.eq( [ "y" ] , z.a , "useIndex: " + useIndex ) 19 | } 20 | ); 21 | 22 | } 23 | 24 | test( false ) 25 | test( true ) 26 | -------------------------------------------------------------------------------- /src/mongo/db/SConscript: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | 3 | Import("env") 4 | 5 | # 6 | # We'd like 'common' to have the abstractions that are shared by several components of the 7 | # server. Ideally, many of the object in 'coredb' should be moved here when their dependencies 8 | # get resolved. 9 | # 10 | 11 | env.StaticLibrary('common', ['field_ref.cpp'], 12 | LIBDEPS=['$BUILD_DIR/mongo/bson', 13 | '$BUILD_DIR/mongo/foundation']) 14 | 15 | env.CppUnitTest('field_ref_test', ['field_ref_test.cpp'], LIBDEPS=['common']) 16 | -------------------------------------------------------------------------------- /standalone/timing.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TIMING_HPP 2 | #define TIMING_HPP 3 | 4 | // ============================================================================ 5 | // TIMING 6 | // ============================================================================ 7 | #ifdef _WIN32 8 | #include 9 | #define WALLCLOCK() ((double)GetTickCount()*1e-3) 10 | 11 | #else 12 | 13 | #include 14 | inline double WALLCLOCK() { 15 | struct timeval tv; 16 | gettimeofday(&tv, NULL); 17 | return tv.tv_sec + tv.tv_usec*1e-6; 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /jstests/fm4.js: -------------------------------------------------------------------------------- 1 | t = db.fm4 2 | t.drop(); 3 | 4 | t.insert({_id:1, a:1, b:1}); 5 | 6 | assert.eq( t.findOne({}, {_id:1}), {_id:1}, 1) 7 | assert.eq( t.findOne({}, {_id:0}), {a:1, b:1}, 2) 8 | 9 | assert.eq( t.findOne({}, {_id:1, a:1}), {_id:1, a:1}, 3) 10 | assert.eq( t.findOne({}, {_id:0, a:1}), {a:1}, 4) 11 | 12 | assert.eq( t.findOne({}, {_id:0, a:0}), {b:1}, 6) 13 | assert.eq( t.findOne({}, { a:0}), {_id:1, b:1}, 5) 14 | 15 | // not sure if we want to suport this since it is the same as above 16 | //assert.eq( t.findOne({}, {_id:1, a:0}), {_id:1, b:1}, 5) 17 | -------------------------------------------------------------------------------- /jstests/orb.js: -------------------------------------------------------------------------------- 1 | // check neg direction index and negation 2 | 3 | var t = db.jstests_orb; 4 | t.drop(); 5 | 6 | t.save( {a:1} ); 7 | t.ensureIndex( {a:-1} ); 8 | 9 | assert.eq.automsg( "1", "t.count( {$or: [ { a: { $gt:0,$lt:2 } }, { a: { $gt:-1,$lt:3 } } ] } )" ); 10 | 11 | t.drop(); 12 | 13 | t.save( {a:1,b:1} ); 14 | t.ensureIndex( {a:1,b:-1} ); 15 | 16 | assert.eq.automsg( "1", "t.count( {$or: [ { a: { $gt:0,$lt:2 } }, { a: { $gt:-1,$lt:3 } } ] } )" ); 17 | assert.eq.automsg( "1", "t.count( {$or: [ { a:1, b: { $gt:0,$lt:2 } }, { a:1, b: { $gt:-1,$lt:3 } } ] } )" ); -------------------------------------------------------------------------------- /jstests/regex8.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.regex8; 3 | t.drop() 4 | 5 | t.insert( { _id : 1 , a : "abc" } ) 6 | t.insert( { _ud : 2 , a : "abc" } ) 7 | t.insert( { _id : 3 , a : "bdc" } ) 8 | 9 | function test( msg ){ 10 | assert.eq( 3 , t.find().itcount() , msg + "1" ) 11 | assert.eq( 2 , t.find( { a : /a.*/ } ).itcount() , msg + "2" ) 12 | assert.eq( 3 , t.find( { a : /[ab].*/ } ).itcount() , msg + "3" ) 13 | assert.eq( 3 , t.find( { a : /[a|b].*/ } ).itcount() , msg + "4" ) 14 | } 15 | 16 | test( "A" ); 17 | 18 | t.ensureIndex( { a : 1 } ) 19 | test( "B" ) 20 | -------------------------------------------------------------------------------- /jstests/slowWeekly/geo_near_random1.js: -------------------------------------------------------------------------------- 1 | // this tests all points using $near 2 | load("jstests/libs/geo_near_random.js"); 3 | load( "jstests/libs/slow_weekly_util.js" ) 4 | 5 | testServer = new SlowWeeklyMongod( "geo_near_random1" ) 6 | db = testServer.getDB( "test" ); 7 | 8 | 9 | 10 | var test = new GeoNearRandomTest("weekly.geo_near_random1"); 11 | 12 | test.insertPts(1000); 13 | 14 | test.testPt([0,0]); 15 | test.testPt(test.mkPt()); 16 | test.testPt(test.mkPt()); 17 | test.testPt(test.mkPt()); 18 | test.testPt(test.mkPt()); 19 | 20 | 21 | testServer.stop(); 22 | -------------------------------------------------------------------------------- /jstests/queryoptimizerc.js: -------------------------------------------------------------------------------- 1 | // Use of an $atomic match expression does not affect choice of index. SERVER-5354 2 | 3 | t = db.jstests_queryoptimizerc; 4 | t.drop(); 5 | 6 | function checkExplainResults( explain ) { 7 | assert.eq( 'BtreeCursor a_1', explain.cursor ); // a:1 index chosen. 8 | assert.eq( 1, explain.allPlans.length ); // Only one (optimal) plan is attempted. 9 | } 10 | 11 | t.ensureIndex( { a:1 } ); 12 | 13 | checkExplainResults( t.find( { a:1 } ).explain( true ) ); 14 | checkExplainResults( t.find( { a:1, $atomic:1 } ).explain( true ) ); 15 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/config/platform/cray.hpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright John Maddock 2011. 2 | // Use, modification and distribution are subject to the 3 | // Boost Software License, Version 1.0. (See accompanying file 4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | 7 | // See http://www.boost.org for most recent version. 8 | 9 | // SGI Irix specific config options: 10 | 11 | #define BOOST_PLATFORM "Cray" 12 | 13 | // boilerplate code: 14 | #define BOOST_HAS_UNISTD_H 15 | #include 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /jstests/datasize2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.datasize2 3 | t.drop(); 4 | 5 | N = 1000 6 | for ( i=0; i../build//boost_filesystem 12 | true 13 | ; 14 | 15 | exe file_size : file_size.cpp ; 16 | exe simple_ls : simple_ls.cpp ; 17 | -------------------------------------------------------------------------------- /jstests/disk/newcollection1.js: -------------------------------------------------------------------------------- 1 | // SERVER-4560 test 2 | 3 | port = allocatePorts( 1 )[ 0 ] 4 | var baseName = "jstests_disk_newcollection1"; 5 | var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", "/data/db/" + baseName ); 6 | 7 | db = m.getDB( "test" ); 8 | 9 | db.dropDatabase(); 10 | 11 | var colls = db.getCollectionNames(); 12 | 13 | assert ( colls.length==0 ); 14 | 15 | db.createCollection("broken", {capped: true, size: -1}); 16 | 17 | var new_colls = db.getCollectionNames(); 18 | 19 | print (new_colls); 20 | assert( new_colls.length==0 ); 21 | -------------------------------------------------------------------------------- /jstests/geo_multikey1.js: -------------------------------------------------------------------------------- 1 | // Multikey geo index tests with parallel arrays. 2 | 3 | t = db.jstests_geo_multikey1; 4 | t.drop(); 5 | 6 | locArr = []; 7 | arr = []; 8 | for( i = 0; i < 10; ++i ) { 9 | locArr.push( [i,i+1] ); 10 | arr.push( i ); 11 | } 12 | t.save( {loc:locArr,a:arr,b:arr,c:arr} ); 13 | 14 | // Parallel arrays are allowed for geo indexes. 15 | t.ensureIndex( {loc:'2d',a:1,b:1,c:1} ); 16 | assert( !db.getLastError() ); 17 | 18 | // Parallel arrays are not allowed for normal indexes. 19 | t.ensureIndex( {loc:1,a:1,b:1,c:1} ); 20 | assert( db.getLastError() ); 21 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Automatic redirection failed, please go to 7 | doc/index.htm. 8 |
9 |

© Copyright Beman Dawes, 2003

10 |

Distributed under the Boost Software 11 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 12 | www.boost.org/LICENSE_1_0.txt)

13 | 14 | 15 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server7768.js: -------------------------------------------------------------------------------- 1 | // SEVER-7768 aggregate cmd shouldn't fail when $readPreference is specified 2 | collection = 'server7768'; 3 | db[collection].drop(); 4 | db[collection].insert({foo:1}); 5 | // Can't use aggregate helper here because we need to add $readPreference flag 6 | res = db.runCommand({ 'aggregate': collection 7 | , 'pipeline': [{'$project': {'_id': false, 'foo': true}}] 8 | , $readPreference: {'mode': 'primary'} 9 | }); 10 | 11 | assert.commandWorked(res); 12 | assert.eq(res.result, [{foo:1}]) 13 | -------------------------------------------------------------------------------- /jstests/perf/index1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.perf.index1; 3 | t.drop(); 4 | 5 | for ( var i=0; i<100000; i++ ){ 6 | t.save( { x : i } ); 7 | } 8 | 9 | t.findOne(); 10 | 11 | printjson( db.serverStatus().mem ); 12 | 13 | for ( var i=0; i<5; i++ ){ 14 | nonu = Date.timeFunc( function(){ t.ensureIndex( { x : 1 } ); } ); 15 | t.dropIndex( { x : 1 } ); 16 | u = Date.timeFunc( function(){ t.ensureIndex( { x : 1 }, { unique : 1 } ); } ); 17 | t.dropIndex( { x : 1 } ); 18 | print( "non unique: " + nonu + " unique: " + u ); 19 | printjson( db.serverStatus().mem ); 20 | } 21 | -------------------------------------------------------------------------------- /jstests/shellstartparallel.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | throw "intentional_throw_to_test_assert_throws"; 3 | } 4 | assert.throws(f); 5 | 6 | // verify that join works 7 | db.sps.drop(); 8 | join = startParallelShell("sleep(1000); db.sps.insert({x:1}); db.getLastError();"); 9 | join(); 10 | assert.eq(1, db.sps.count(), "join problem?"); 11 | 12 | // test with a throw 13 | join = startParallelShell("db.sps.insert({x:1}); db.getLastError(); throw 'intentionally_uncaught';"); 14 | join(); 15 | assert.eq(2, db.sps.count(), "join2 problem?"); 16 | 17 | print("shellstartparallel.js SUCCESS"); 18 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/type.hpp: -------------------------------------------------------------------------------- 1 | // (C) Copyright David Abrahams 2001. 2 | // Distributed under the Boost Software License, Version 1.0. (See 3 | // accompanying file LICENSE_1_0.txt or copy at 4 | // http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef BOOST_TYPE_DWA20010120_HPP 7 | # define BOOST_TYPE_DWA20010120_HPP 8 | 9 | namespace boost { 10 | 11 | // Just a simple "type envelope". Useful in various contexts, mostly to work 12 | // around some MSVC deficiencies. 13 | template 14 | struct type {}; 15 | 16 | } 17 | 18 | #endif // BOOST_TYPE_DWA20010120_HPP 19 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/weak_ptr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_WEAK_PTR_HPP_INCLUDED 2 | #define BOOST_WEAK_PTR_HPP_INCLUDED 3 | 4 | // 5 | // weak_ptr.hpp 6 | // 7 | // Copyright (c) 2001, 2002, 2003 Peter Dimov 8 | // 9 | // Distributed under the Boost Software License, Version 1.0. 10 | // See accompanying file LICENSE_1_0.txt or copy at 11 | // http://www.boost.org/LICENSE_1_0.txt 12 | // 13 | // See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation. 14 | // 15 | 16 | #include 17 | 18 | #endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED 19 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6779.js: -------------------------------------------------------------------------------- 1 | // server 6779: serializing ExpressionCoerceToBool 2 | // This test only fails in debug mode with the bug since that tests round-tripping 3 | function test(op, val) { 4 | t = db.server6779; 5 | t.drop(); 6 | 7 | t.insert({a:true}); 8 | t.insert({a:false}); 9 | 10 | obj = {}; 11 | obj[op] = ['$a', val]; 12 | result = t.aggregate({$project: {_id: 0, bool: obj}}); 13 | 14 | assert.commandWorked(result); 15 | assert.eq(result.result, [{bool:true}, {bool:false}]); 16 | } 17 | test('$and', true); 18 | test('$or', false); 19 | -------------------------------------------------------------------------------- /jstests/eval5.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval5; 3 | t.drop(); 4 | 5 | t.save( { a : 1 , b : 2 , c : 3 } ); 6 | 7 | assert.eq( 3 , 8 | db.eval( 9 | function(z){ 10 | return db.eval5.find().toArray()[0].c; 11 | } 12 | ) , 13 | "something weird A" 14 | ); 15 | 16 | assert.isnull( 17 | db.eval( 18 | function(z){ 19 | return db.eval5.find( {} , { a : 1 } ).toArray()[0].c; 20 | } 21 | ), 22 | "field spec didn't work" 23 | ); 24 | -------------------------------------------------------------------------------- /jstests/remove9.js: -------------------------------------------------------------------------------- 1 | // SERVER-2009 Count odd numbered entries while updating and deleting even numbered entries. 2 | 3 | t = db.jstests_remove9; 4 | t.drop(); 5 | t.ensureIndex( {i:1} ); 6 | for( i = 0; i < 1000; ++i ) { 7 | t.save( {i:i} ); 8 | } 9 | 10 | s = startParallelShell( 't = db.jstests_remove9; for( j = 0; j < 5000; ++j ) { i = Random.randInt( 499 ) * 2; t.update( {i:i}, {$set:{i:2000}} ); t.remove( {i:2000} ); t.save( {i:i} ); }' ); 11 | 12 | for( i = 0; i < 1000; ++i ) { 13 | assert.eq( 500, t.find( {i:{$gte:0,$mod:[2,1]}} ).hint( {i:1} ).itcount() ); 14 | } 15 | 16 | s(); 17 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/make_shared.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED 2 | #define BOOST_MAKE_SHARED_HPP_INCLUDED 3 | 4 | // make_shared.hpp 5 | // 6 | // Copyright (c) 2007, 2008 Peter Dimov 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. 9 | // See accompanying file LICENSE_1_0.txt or copy at 10 | // http://www.boost.org/LICENSE_1_0.txt 11 | // 12 | // See http://www.boost.org/libs/smart_ptr/make_shared.html 13 | // for documentation. 14 | 15 | #include 16 | 17 | #endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED 18 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Kristina Chodorow on 2 | Tue, 07 Apr 2009 10:18:58 -0400. 3 | 4 | It was downloaded from http://www.mongodb.org 5 | 6 | Upstream Authors: 7 | 8 | Eliot Horowitz 9 | Dwight Merriman 10 | Aaron Staple 11 | Michael Dirolf 12 | Kristina Chodorow 13 | 14 | Copyright: 15 | 16 | 2009 10gen 17 | 18 | License: 19 | 20 | AGPL 21 | 22 | The Debian packaging is (C) 2009, Kristina Chodorow and 23 | is licensed under the AGPL, see `http://www.fsf.org/licensing/licenses/agpl-3.0.html'. 24 | -------------------------------------------------------------------------------- /jstests/js9.js: -------------------------------------------------------------------------------- 1 | c = db.jstests_js9; 2 | c.drop(); 3 | 4 | c.save( { a : 1 } ); 5 | c.save( { a : 2 } ); 6 | 7 | 8 | assert.eq( 2 , c.find().length() ); 9 | assert.eq( 2 , c.find().count() ); 10 | 11 | 12 | assert.eq( 2 , 13 | db.eval( 14 | function(){ 15 | num = 0; 16 | db.jstests_js9.find().forEach( 17 | function(z){ 18 | num++; 19 | } 20 | ); 21 | return num; 22 | } 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /jstests/parallel/basic.js: -------------------------------------------------------------------------------- 1 | // perform basic js tests in parallel 2 | 3 | Random.setRandomSeed(); 4 | 5 | var params = ParallelTester.createJstestsLists( 4 ); 6 | var t = new ParallelTester(); 7 | for( i in params ) { 8 | t.add( ParallelTester.fileTester, params[ i ] ); 9 | } 10 | 11 | t.run( "one or more tests failed", true ); 12 | 13 | db.getCollectionNames().forEach( function( x ) { 14 | v = db[ x ].validate(); 15 | assert( v.valid, "validate failed for " + x + " with " + tojson( v ) ); 16 | } ); -------------------------------------------------------------------------------- /jstests/regex_util.js: -------------------------------------------------------------------------------- 1 | // Tests for RegExp.escape 2 | 3 | (function() { 4 | var TEST_STRINGS = [ 5 | "[db]", 6 | "{ab}", 7 | "", 8 | "(abc)", 9 | "^first^", 10 | "&addr", 11 | "k@10gen.com", 12 | "#4", 13 | "!b", 14 | "<>3", 15 | "****word+", 16 | "\t| |\n\r", 17 | "Mongo-db", 18 | "[{(<>)}]!@#%^&*+\\" 19 | ]; 20 | 21 | TEST_STRINGS.forEach(function (str) { 22 | var escaped = RegExp.escape(str); 23 | var regex = new RegExp(escaped); 24 | assert(regex.test(str), "Wrong escape for " + str); 25 | }); 26 | })(); 27 | 28 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/scoped_ptr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED 2 | #define BOOST_SCOPED_PTR_HPP_INCLUDED 3 | 4 | // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. 5 | // Copyright (c) 2001, 2002 Peter Dimov 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See 8 | // accompanying file LICENSE_1_0.txt or copy at 9 | // http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | // http://www.boost.org/libs/smart_ptr/scoped_ptr.htm 12 | // 13 | 14 | #include 15 | 16 | #endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED 17 | -------------------------------------------------------------------------------- /jstests/auth/readProfile.js: -------------------------------------------------------------------------------- 1 | var conn = MongoRunner.runMongod({auth : ""}); 2 | 3 | var adminDb = conn.getDB("admin"); 4 | var testDb = conn.getDB("testdb"); 5 | 6 | adminDb.addUser({user:'admin', 7 | pwd:'password', 8 | roles:['userAdminAnyDatabase','dbAdminAnyDatabase', 'readWriteAnyDatabase']}); 9 | 10 | adminDb.auth('admin','password'); 11 | testDb.addUser({user:'readUser',pwd:'password',roles:['read']}); 12 | testDb.setProfilingLevel(2); 13 | adminDb.logout(); 14 | testDb.auth('readUser','password'); 15 | assert.throws(function() { testDb.system.profile.findOne(); }); -------------------------------------------------------------------------------- /jstests/count7.js: -------------------------------------------------------------------------------- 1 | // Check normal count matching and deduping. 2 | 3 | t = db.jstests_count7; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1} ); 7 | t.save( {a:'algebra'} ); 8 | t.save( {a:'apple'} ); 9 | t.save( {a:'azores'} ); 10 | t.save( {a:'bumper'} ); 11 | t.save( {a:'supper'} ); 12 | t.save( {a:'termite'} ); 13 | t.save( {a:'zeppelin'} ); 14 | t.save( {a:'ziggurat'} ); 15 | t.save( {a:'zope'} ); 16 | 17 | assert.eq( 5, t.count( {a:/p/} ) ); 18 | 19 | t.remove(); 20 | 21 | t.save( {a:[1,2,3]} ); 22 | t.save( {a:[1,2,3]} ); 23 | t.save( {a:[1]} ); 24 | 25 | assert.eq( 2, t.count( {a:{$gt:1}} ) ); 26 | -------------------------------------------------------------------------------- /jstests/inc2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.inc2 3 | t.drop(); 4 | 5 | t.save( { _id : 1 , x : 1 } ); 6 | t.save( { _id : 2 , x : 2 } ); 7 | t.save( { _id : 3 , x : 3 } ); 8 | 9 | function order(){ 10 | return t.find().sort( { x : 1 } ).map( function(z){ return z._id; } ); 11 | } 12 | 13 | assert.eq( "1,2,3" , order() , "A" ); 14 | 15 | t.update( { _id : 1 } , { $inc : { x : 4 } } ); 16 | assert.eq( "2,3,1" , order() , "B" ); 17 | 18 | t.ensureIndex( { x : 1 } ); 19 | assert.eq( "2,3,1" , order() , "C" ); 20 | 21 | t.update( { _id : 3 } , { $inc : { x : 4 } } ); 22 | assert.eq( "2,1,3" , order() , "D" ); 23 | -------------------------------------------------------------------------------- /jstests/index5.js: -------------------------------------------------------------------------------- 1 | // index5.js - test reverse direction index 2 | 3 | function validate() { 4 | assert.eq( 2, t.find().count() ); 5 | f = t.find().sort( { a: 1 } ); 6 | assert.eq( 2, t.count() ); 7 | assert.eq( 1, f[ 0 ].a ); 8 | assert.eq( 2, f[ 1 ].a ); 9 | r = t.find().sort( { a: -1 } ); 10 | assert.eq( 2, r.count() ); 11 | assert.eq( 2, r[ 0 ].a ); 12 | assert.eq( 1, r[ 1 ].a ); 13 | } 14 | 15 | t = db.index5; 16 | t.drop(); 17 | 18 | t.save( { a: 1 } ); 19 | t.save( { a: 2 } ); 20 | 21 | validate(); 22 | 23 | t.ensureIndex( { a: -1 } ); 24 | validate(); 25 | -------------------------------------------------------------------------------- /jstests/indexa.js: -------------------------------------------------------------------------------- 1 | // unique index constraint test for updates 2 | // case where object doesn't grow tested here 3 | 4 | t = db.indexa; 5 | t.drop(); 6 | 7 | t.ensureIndex( { x:1 }, true ); 8 | 9 | t.insert( { 'x':'A' } ); 10 | t.insert( { 'x':'B' } ); 11 | t.insert( { 'x':'A' } ); 12 | 13 | assert.eq( 2 , t.count() , "indexa 1" ); 14 | 15 | t.update( {x:'B'}, { x:'A' } ); 16 | 17 | a = t.find().toArray(); 18 | u = Array.unique( a.map( function(z){ return z.x } ) ); 19 | assert.eq( 2 , t.count() , "indexa 2" ); 20 | 21 | assert( a.length == u.length , "unique index update is broken" ); 22 | 23 | -------------------------------------------------------------------------------- /jstests/libs/crl.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBazCB1QIBATANBgkqhkiG9w0BAQUFADCBkjELMAkGA1UEBhMCVVMxETAPBgNV 3 | BAgMCE5ldyBZb3JrMRYwFAYDVQQHDA1OZXcgWW9yayBDaXR5MQ4wDAYDVQQKDAUx 4 | MEdlbjEPMA0GA1UECwwGS2VybmVsMRowGAYDVQQDDBFNeSBDZXJ0IEF1dGhvcml0 5 | eTEbMBkGCSqGSIb3DQEJARYMcm9vdEBsYXphcnVzFw0xMjEyMTIxODQ3NDFaFw00 6 | MDA0MjgxODQ3NDFaoA4wDDAKBgNVHRQEAwIBCzANBgkqhkiG9w0BAQUFAAOBgQAu 7 | PlPDGei2q6kdkoHe8vmDuts7Hm/o9LFbBmn0XUcfHisCJCPsJTyGCsgnfIiBcXJY 8 | 1LMKsQFnYGv28rE2ZPpFg2qNxL+6qUEzCvqaHLX9q1V0F+f8hHDxucNYu52oo/h0 9 | uNZxB1KPFI2PReG5d3oUYqJ2+EctKkrGtxSPzbN0gg== 10 | -----END X509 CRL----- 11 | -------------------------------------------------------------------------------- /jstests/pullall2.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.pullall2 3 | t.drop() 4 | 5 | o = { _id : 1 , a : [] } 6 | for ( i=0; i<5; i++ ) 7 | o.a.push( { x : i , y : i } ) 8 | 9 | t.insert( o ) 10 | 11 | assert.eq( o , t.findOne() , "A" ); 12 | 13 | t.update( {} , { $pull : { a : { x : 3 } } } ) 14 | o.a = o.a.filter( function(z){ return z.x != 3 } ) 15 | assert.eq( o , t.findOne() , "B" ); 16 | 17 | t.update( {} , { $pull : { a : { x : { $in : [ 1 , 4 ] } } } } ); 18 | o.a = o.a.filter( function(z){ return z.x != 1 } ) 19 | o.a = o.a.filter( function(z){ return z.x != 4 } ) 20 | assert.eq( o , t.findOne() , "C" ); 21 | -------------------------------------------------------------------------------- /jstests/dropdb.js: -------------------------------------------------------------------------------- 1 | // Test that a db does not exist after it is dropped. 2 | // Disabled in the small oplog suite because the slave may create a master db 3 | // with the same name as the dropped db when requesting a clone. 4 | 5 | m = db.getMongo(); 6 | baseName = "jstests_dropdb"; 7 | ddb = db.getSisterDB( baseName ); 8 | 9 | ddb.c.save( {} ); 10 | ddb.getLastError(); 11 | assert.neq( -1, m.getDBNames().indexOf( baseName ) ); 12 | 13 | ddb.dropDatabase(); 14 | assert.eq( -1, m.getDBNames().indexOf( baseName ) ); 15 | 16 | ddb.dropDatabase(); 17 | assert.eq( -1, m.getDBNames().indexOf( baseName ) ); 18 | -------------------------------------------------------------------------------- /jstests/inb.js: -------------------------------------------------------------------------------- 1 | // Test $in regular expressions with overlapping index bounds. SERVER-4677 2 | 3 | t = db.jstests_inb; 4 | t.drop(); 5 | 6 | function checkBoundsAndResults( query ) { 7 | assert.eq( [ 'a', 'b' ], t.find( query ).explain().indexBounds.x[0] ); 8 | assert.eq( 4, t.count( query ) ); 9 | assert.eq( 4, t.find( query ).itcount() ); 10 | } 11 | 12 | t.ensureIndex( {x:1} ); 13 | t.save( {x:'aa'} ); 14 | t.save( {x:'ab'} ); 15 | t.save( {x:'ac'} ); 16 | t.save( {x:'ad'} ); 17 | 18 | checkBoundsAndResults( {x:{$in:[/^a/,/^ab/]}} ); 19 | checkBoundsAndResults( {x:{$in:[/^ab/,/^a/]}} ); 20 | -------------------------------------------------------------------------------- /jstests/libs/crl_expired.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBazCB1QIBATANBgkqhkiG9w0BAQUFADCBkjELMAkGA1UEBhMCVVMxETAPBgNV 3 | BAgMCE5ldyBZb3JrMRYwFAYDVQQHDA1OZXcgWW9yayBDaXR5MQ4wDAYDVQQKDAUx 4 | MEdlbjEPMA0GA1UECwwGS2VybmVsMRowGAYDVQQDDBFNeSBDZXJ0IEF1dGhvcml0 5 | eTEbMBkGCSqGSIb3DQEJARYMcm9vdEBsYXphcnVzFw0xMjEyMTIxODQwNTBaFw0x 6 | MzAxMTExODQwNTBaoA4wDDAKBgNVHRQEAwIBAzANBgkqhkiG9w0BAQUFAAOBgQBs 7 | jyvEdX8o0+PfRJsEv5oLwgp5y+YmKjRlXg2oj/ETxBDKNYtBY7B9Uu9q0chFtwTu 8 | XMXeEFWuxnKG+4Ovp6JmNcCKkttUwsWQuR6dGpClW6ttTk0putAWtDnqukTPlEQ2 9 | XU3wco7ZgrTphvuGpaIQLM1sQg9x8SfW3q6/hxYm3A== 10 | -----END X509 CRL----- 11 | -------------------------------------------------------------------------------- /jstests/mr_undef.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.mr_undef 3 | t.drop() 4 | 5 | outname = "mr_undef_out" 6 | out = db[outname] 7 | out.drop() 8 | 9 | t.insert({x : 0}) 10 | 11 | var m = function() { emit(this.mod, this.x); } 12 | var r = function(k,v) { total = 0; for(i in v) { total+= v[i]; } return total; } 13 | 14 | res = t.mapReduce(m, r, {out : outname } ) 15 | 16 | assert.eq( 0 , out.find( { _id : { $type : 6 } } ).itcount() , "A1" ) 17 | assert.eq( 1 , out.find( { _id : { $type : 10 } } ).itcount() , "A2" ) 18 | 19 | x = out.findOne() 20 | assert.eq( x , out.findOne( { _id : x["_id"] } ) , "A3" ) 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/scoped_array.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED 2 | #define BOOST_SCOPED_ARRAY_HPP_INCLUDED 3 | 4 | // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. 5 | // Copyright (c) 2001, 2002 Peter Dimov 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See 8 | // accompanying file LICENSE_1_0.txt or copy at 9 | // http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | // http://www.boost.org/libs/smart_ptr/scoped_array.htm 12 | // 13 | 14 | #include 15 | 16 | #endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED 17 | -------------------------------------------------------------------------------- /jstests/not1.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.not1; 3 | t.drop(); 4 | 5 | 6 | t.insert({a:1}) 7 | t.insert({a:2}) 8 | t.insert({}) 9 | 10 | function test( name ){ 11 | assert.eq( 3 , t.find().count() , name + "A" ); 12 | assert.eq( 1 , t.find( { a : 1 } ).count() , name + "B" ); 13 | assert.eq( 2 , t.find( { a : { $ne : 1 } } ).count() , name + "C" ); // SERVER-198 14 | assert.eq( 1 , t.find({a:{$in:[1]}}).count() , name + "D" ); 15 | assert.eq( 2 , t.find({a:{$nin:[1]}}).count() , name + "E" ); // SERVER-198 16 | } 17 | 18 | test( "no index" ); 19 | t.ensureIndex( { a : 1 } ); 20 | test( "with index" ); 21 | -------------------------------------------------------------------------------- /jstests/numberlong4.js: -------------------------------------------------------------------------------- 1 | // Test handling of comparison between long longs and their double approximations in btrees - SERVER-3719. 2 | 3 | t = db.jstests_numberlong4; 4 | t.drop(); 5 | 6 | if ( 0 ) { // SERVER-3719 7 | 8 | t.ensureIndex({x:1}); 9 | 10 | Random.setRandomSeed(); 11 | 12 | s = "11235399833116571"; 13 | for( i = 0; i < 10000; ++i ) { 14 | n = NumberLong( s + Random.randInt( 10 ) ); 15 | t.insert( { x: ( Random.randInt( 2 ) ? n : n.floatApprox ) } ); 16 | } 17 | 18 | // If this does not return, there is a problem with index structure. 19 | t.find().hint({x:1}).itcount(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jstests/disk/dbNoCreate.js: -------------------------------------------------------------------------------- 1 | var baseName = "jstests_dbNoCreate"; 2 | 3 | var m = startMongod( "--port", "27018", "--dbpath", "/data/db/" + baseName ); 4 | 5 | var t = m.getDB( baseName ).t; 6 | 7 | var no = function( dbName ) { 8 | assert.eq( -1, db.getMongo().getDBNames().indexOf( dbName ) ); 9 | } 10 | 11 | assert.eq( 0, t.find().toArray().length ); 12 | t.remove(); 13 | t.update( {}, { a:1 } ); 14 | t.drop(); 15 | 16 | stopMongod( 27018 ); 17 | 18 | var m = startMongoProgram( "mongod", "--port", "27018", "--dbpath", "/data/db/" + baseName ); 19 | assert.eq( -1, m.getDBNames().indexOf( baseName ) ); 20 | -------------------------------------------------------------------------------- /jstests/explain3.js: -------------------------------------------------------------------------------- 1 | /** SERVER-2451 Kill cursor while explain is yielding */ 2 | 3 | t = db.jstests_explain3; 4 | t.drop(); 5 | 6 | t.ensureIndex( {i:1} ); 7 | for( var i = 0; i < 10000; ++i ) { 8 | t.save( {i:i,j:0} ); 9 | } 10 | db.getLastError(); 11 | 12 | s = startParallelShell( "sleep( 20 ); db.jstests_explain3.dropIndex( {i:1} );" ); 13 | 14 | try { 15 | t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain() 16 | } catch (e) { 17 | print( "got exception" ); 18 | printjson( e ); 19 | } 20 | 21 | s(); 22 | 23 | // Sanity check to make sure mongod didn't seg fault. 24 | assert.eq( 10000, t.count() ); -------------------------------------------------------------------------------- /jstests/server1470.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.server1470; 3 | t.drop(); 4 | 5 | q = { "name" : "first" , "pic" : { "$ref" : "foo", "$id" : ObjectId("4c48d04cd33a5a92628c9af6") } }; 6 | t.update( q , {$set:{ x : 1 } } , true, true ); 7 | ref = t.findOne().pic 8 | assert.eq( "object", typeof( ref ) ); 9 | assert.eq( q.pic["$ref"] , ref["$ref"] ) 10 | assert.eq( q.pic["$id"] , ref["$id"] ) 11 | 12 | // just make we haven't broken other update operators 13 | t.drop(); 14 | t.update( { _id : 1 , x : { $gt : 5 } } , { $set : { y : 1 } } , true ); 15 | assert.eq( { _id : 1 , y : 1 } , t.findOne() ); 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/mongo/db/kdtree/DBHandler.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DBHANDLER_HPP_ 2 | #define DBHANDLER_HPP_ 3 | 4 | #include 5 | 6 | #include "CudaDb.hpp" 7 | 8 | using namespace std; 9 | 10 | namespace mongo { 11 | 12 | class DBHandler { 13 | 14 | 15 | private: 16 | DBHandler(); 17 | ~DBHandler(); 18 | static DBHandler* instance; 19 | boost::unordered_map devices; 20 | 21 | public: 22 | static DBHandler* getInstance(); 23 | CudaDb* getCudaDb(const char *binFile, const char *rangeFile, const char *treeFile, int keySize); 24 | }; 25 | 26 | 27 | } 28 | 29 | 30 | 31 | #endif /* DBHANDLER_HPP_ */ 32 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/intrusive_ptr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED 2 | #define BOOST_INTRUSIVE_PTR_HPP_INCLUDED 3 | 4 | // 5 | // intrusive_ptr.hpp 6 | // 7 | // Copyright (c) 2001, 2002 Peter Dimov 8 | // 9 | // Distributed under the Boost Software License, Version 1.0. 10 | // See accompanying file LICENSE_1_0.txt or copy at 11 | // http://www.boost.org/LICENSE_1_0.txt 12 | // 13 | // See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation. 14 | // 15 | 16 | #include 17 | 18 | #endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED 19 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/type_traits/aligned_storage.hpp: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (C) John Maddock 2005. 3 | // Use, modification and distribution are subject to the Boost Software License, 4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt). 6 | // 7 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. 8 | 9 | #ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED 10 | # define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED 11 | # include 12 | #endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED 13 | 14 | -------------------------------------------------------------------------------- /src/third_party/boost/libs/filesystem/v3/doc/src/README: -------------------------------------------------------------------------------- 1 | This directory contains the source files used to generate the Filesystem library 2 | reference documentation and the TR2 filesystem proposal. The generated HTML files 3 | contain much common material that would be difficult to keep in sync if maintained 4 | as separate files. 5 | 6 | Generation is performed by the Minimal Macro Processor, available from 7 | https://github.com/Beman/mmp 8 | 9 | ------------ 10 | 11 | Copyright Beman Dawes 2012 12 | 13 | Distributed under the Boost Software Licence Version 1.0. 14 | See http://www.boost.org/LICENSE_1_0.txt 15 | -------------------------------------------------------------------------------- /jstests/aggregation/bugs/server6238.js: -------------------------------------------------------------------------------- 1 | // do not allow creation of fields with a $ prefix 2 | load('jstests/aggregation/extras/utils.js'); 3 | 4 | c = db.c; 5 | c.drop(); 6 | 7 | c.insert({a:1}); 8 | 9 | // assert that we get the proper error in both $project and $group 10 | assertErrorCode(c, {$project:{$a:"$a"}}, 16404); 11 | assertErrorCode(c, {$project:{a:{$b: "$a"}}}, 15999); 12 | assertErrorCode(c, {$project:{a:{"$b": "$a"}}}, 15999); 13 | assertErrorCode(c, {$project:{'a.$b':"$a"}}, 16410); 14 | assertErrorCode(c, {$group:{_id: "$_id", $a:"$a"}}, 15950); 15 | assertErrorCode(c, {$group:{_id: {$a:"$a"}}}, 15999); 16 | -------------------------------------------------------------------------------- /src/third_party/boost/boost/type_traits/detail/size_t_trait_undef.hpp: -------------------------------------------------------------------------------- 1 | 2 | // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION 3 | 4 | // Copyright Aleksey Gurtovoy 2002-2004 5 | // 6 | // Distributed under the Boost Software License, Version 1.0. 7 | // (See accompanying file LICENSE_1_0.txt or copy at 8 | // http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | // $Source$ 11 | // $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ 12 | // $Revision: 24874 $ 13 | 14 | #undef BOOST_TT_AUX_SIZE_T_TRAIT_DEF1 15 | #undef BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1 16 | #undef BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1 17 | -------------------------------------------------------------------------------- /jstests/basicc.js: -------------------------------------------------------------------------------- 1 | // test writing to two db's at the same time. 2 | 3 | t1 = db.jstests_basicc; 4 | var db = db.getSisterDB("test_basicc"); 5 | t2 = db.jstests_basicc; 6 | t1.drop(); 7 | t2.drop(); 8 | 9 | js = "while( 1 ) { db.jstests.basicc1.save( {} ); }"; 10 | pid = startMongoProgramNoConnect( "mongo" , "--eval" , js , db.getMongo().host ); 11 | 12 | for( var i = 0; i < 1000; ++i ) { 13 | t2.save( {} ); 14 | } 15 | assert.automsg( "!db.getLastError()" ); 16 | stopMongoProgramByPid( pid ); 17 | // put things back the way we found it 18 | t1.drop(); 19 | t2.drop(); 20 | db.dropDatabase(); 21 | db = db.getSisterDB("test"); -------------------------------------------------------------------------------- /jstests/capped_empty.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.capped_empty; 3 | t.drop(); 4 | 5 | db.createCollection( t.getName() , { capped : true , size : 100 } ) 6 | 7 | t.insert( { x : 1 } ); 8 | t.insert( { x : 2 } ); 9 | t.insert( { x : 3 } ); 10 | t.ensureIndex( { x : 1 } ); 11 | 12 | assert.eq( 3 , t.count() ); 13 | assert.eq( 1 , t.find( { x : 2 } ).explain().nscanned ); 14 | 15 | t.runCommand( "emptycapped" ); 16 | 17 | assert.eq( 0 , t.count() ); 18 | 19 | t.insert( { x : 1 } ); 20 | t.insert( { x : 2 } ); 21 | t.insert( { x : 3 } ); 22 | 23 | assert.eq( 3 , t.count() ); 24 | assert.eq( 1 , t.find( { x : 2 } ).explain().nscanned ); 25 | -------------------------------------------------------------------------------- /jstests/covered_index_sort_2.js: -------------------------------------------------------------------------------- 1 | // Simple covered index query test with sort on _id 2 | 3 | var coll = db.getCollection("covered_sort_2") 4 | coll.drop() 5 | for (i=0;i<10;i++) { 6 | coll.insert({_id:i}) 7 | } 8 | coll.insert({_id:"1"}) 9 | coll.insert({_id:{bar:1}}) 10 | coll.insert({_id:null}) 11 | 12 | // Test no query 13 | var plan = coll.find({}, {_id:1}).sort({_id:-1}).hint({_id:1}).explain() 14 | assert.eq(true, plan.indexOnly, "sort.2.1 - indexOnly should be true on covered query") 15 | assert.eq(0, plan.nscannedObjects, "sort.2.1 - nscannedObjects should be 0 for covered query") 16 | 17 | print ('all tests pass') -------------------------------------------------------------------------------- /jstests/geo_s2nearcorrect.js: -------------------------------------------------------------------------------- 1 | // SERVER-9484 2 | // A geometry may have several covers, one of which is in a search ring and the other of which is 3 | // not. If we see the cover that's not in the search ring, we can't mark the object as 'seen' for 4 | // this ring. 5 | t = db.geo_s2nearcorrect 6 | t.drop() 7 | 8 | longline = { "type" : "LineString", "coordinates": [ [0,0], [179, 89]]}; 9 | t.insert({geo: longline}); 10 | t.ensureIndex({geo: "2dsphere"}); 11 | origin = { "type" : "Point", "coordinates": [ 45, 45] } 12 | assert.eq(1, t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: 20000000} } }).count()); 13 | -------------------------------------------------------------------------------- /jstests/remove.js: -------------------------------------------------------------------------------- 1 | // remove.js 2 | // unit test for db remove 3 | 4 | t = db.removetest; 5 | 6 | function f(n,dir) { 7 | t.ensureIndex({x:dir||1}); 8 | for( i = 0; i < n; i++ ) t.save( { x:3, z:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ); 9 | 10 | assert.eq( n , t.find().count() ); 11 | t.remove({x:3}); 12 | 13 | assert.eq( 0 , t.find().count() ); 14 | 15 | assert( t.findOne() == null , "A:" + tojson( t.findOne() ) ); 16 | assert( t.validate().valid , "B" ); 17 | } 18 | 19 | t.drop(); 20 | f(300, 1); 21 | 22 | f(500, -1); 23 | 24 | assert(t.validate().valid , "C" ); 25 | 26 | -------------------------------------------------------------------------------- /jstests/slowNightly/recstore.js: -------------------------------------------------------------------------------- 1 | // recstore.js 2 | // this is a simple test for new recstores (see reci.h) 3 | // it is probably redundant with other tests but is a convenient starting point 4 | // for testing such things. 5 | 6 | t = db.storetest; 7 | 8 | t.drop(); 9 | 10 | t.save({z:3}); 11 | t.save({z:2}); 12 | 13 | t.ensureIndex({z:1}); 14 | t.ensureIndex({q:1}); 15 | assert( t.find().sort({z:1})[0].z == 2 ); 16 | 17 | t.dropIndexes(); 18 | 19 | assert( t.find().sort({z:1})[0].z == 2 ); 20 | 21 | t.ensureIndex({z:1}); 22 | t.ensureIndex({q:1}); 23 | 24 | db.getSisterDB('admin').$cmd.findOne({closeAllDatabases:1}); 25 | -------------------------------------------------------------------------------- /jstests/update_arraymatch2.js: -------------------------------------------------------------------------------- 1 | t = db.update_arraymatch2; 2 | t.drop(); 3 | 4 | t.insert( { } ); 5 | t.insert( { x : [1,2,3] } ); 6 | t.insert( { x : 99 } ); 7 | t.update( {x : 2}, { $inc : { "x.$" : 1 } } , false, true ); 8 | assert( t.findOne({x:1}).x[1] == 3, "A1" ); 9 | 10 | t.insert( { x : { y : [8,7,6] } } ) 11 | t.update( {'x.y' : 7}, { $inc : { "x.y.$" : 1 } } , false, true ) 12 | assert.eq( 8 , t.findOne({"x.y" : 8}).x.y[1] , "B1" ); 13 | 14 | t.insert( { x : [90,91,92], y : ['a', 'b', 'c'] } ); 15 | t.update( { x : 92} , { $set : { 'y.$' : 'z' } }, false, true ); 16 | assert.eq( 'z', t.findOne({x:92}).y[2], "B2" ); 17 | -------------------------------------------------------------------------------- /jstests/fsync.js: -------------------------------------------------------------------------------- 1 | // test the lock/unlock snapshotting feature a bit 2 | 3 | x=db.runCommand({fsync:1,lock:1}); // not on admin db 4 | assert(!x.ok,"D"); 5 | 6 | x=db.fsyncLock(); // uses admin automatically 7 | 8 | assert(x.ok,"C"); 9 | 10 | y = db.currentOp(); 11 | assert(y.fsyncLock,"B"); 12 | 13 | z = db.fsyncUnlock(); 14 | assert( db.currentOp().fsyncLock == null, "A2" ); 15 | 16 | // make sure the db is unlocked 17 | db.jstests_fsync.insert({x:1}); 18 | db.getLastError(); 19 | 20 | assert( db.currentOp().fsyncLock == null, "A" ); 21 | 22 | assert( !db.eval('db.fsyncLock()').ok, "eval('db.fsyncLock()') should fail." ) 23 | -------------------------------------------------------------------------------- /jstests/gle_shell_server5441.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.server5441; 3 | t.drop(); 4 | 5 | function checkgle(iteration) { 6 | var gle = db.getLastErrorObj(); 7 | assert.eq(2, gle.n, "failed on iteration " + iteration + ", getLastErrorObj()=" + tojson(gle)); 8 | } 9 | 10 | t.insert( { x : 1 } ); 11 | t.insert( { x : 1 } ); 12 | updateReturn = t.update( {} , { $inc : { x : 2 } } , false , true ); 13 | 14 | for ( i=0; i<100; i++ ) { 15 | checkgle(""+i); 16 | } 17 | 18 | db.adminCommand( { replSetGetStatus : 1 , forShell : 1 } ); 19 | shellPrintHelper( updateReturn ) 20 | replSetMemberStatePrompt() 21 | 22 | checkgle("'final'"); 23 | -------------------------------------------------------------------------------- /debian/mongodb.upstart: -------------------------------------------------------------------------------- 1 | # Ubuntu upstart file at /etc/init/mongodb.conf 2 | 3 | limit nofile 20000 20000 4 | 5 | kill timeout 300 # wait 300s between SIGTERM and SIGKILL. 6 | 7 | pre-start script 8 | mkdir -p /var/lib/mongodb/ 9 | mkdir -p /var/log/mongodb/ 10 | end script 11 | 12 | start on runlevel [2345] 13 | stop on runlevel [06] 14 | 15 | script 16 | ENABLE_MONGODB="yes" 17 | if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi 18 | if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf; fi 19 | end script 20 | -------------------------------------------------------------------------------- /jstests/eval3.js: -------------------------------------------------------------------------------- 1 | 2 | t = db.eval3; 3 | t.drop(); 4 | 5 | t.save( { _id : 1 , name : "eliot" } ); 6 | assert.eq( 1 , t.count() , "A" ); 7 | 8 | function z( a , b ){ 9 | db.eval3.save( { _id : a , name : b } ); 10 | return b; 11 | } 12 | 13 | z( 2 , "sara" ); 14 | assert.eq( 2 , t.count() , "B" ); 15 | 16 | assert.eq( "eliot,sara" , t.find().toArray().map( function(z){ return z.name; } ).sort().toString() ); 17 | 18 | assert.eq( "joe" , db.eval( z , 3 , "joe" ) , "C" ); 19 | assert.eq( 3 , t.count() , "D" ); 20 | 21 | assert.eq( "eliot,joe,sara" , t.find().toArray().map( function(z){ return z.name; } ).sort().toString() ); 22 | -------------------------------------------------------------------------------- /jstests/indexq.js: -------------------------------------------------------------------------------- 1 | // Test multikey range preference for a fully included range SERVER-958. 2 | 3 | t = db.jstests_indexq; 4 | t.drop(); 5 | 6 | t.ensureIndex( {a:1} ); 7 | // Single key index 8 | assert.eq( 5, t.find( {a:{$gt:4,$gte:5}} ).explain().indexBounds.a[ 0 ][ 0 ] ); 9 | assert.eq( [[1,1],[2,2]], t.find( {a:{$in:[1,2,3]},$or:[{a:{$in:[1,2]}}]} ).explain().indexBounds.a ); 10 | 11 | t.save( {a:[1,3]} ); 12 | // Now with multi key index. 13 | assert.eq( 5, t.find( {a:{$gt:4,$gte:5}} ).explain().indexBounds.a[ 0 ][ 0 ] ); 14 | assert.eq( [[1,1],[2,2]], t.find( {a:{$in:[1,2,3]},$or:[{a:{$in:[1,2]}}]} ).explain().indexBounds.a ); 15 | --------------------------------------------------------------------------------