Created
August 20, 2009 04:06
-
-
Save arnaudsj/170812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Install MongoDB and launch it: | |
21:44:59 ^ $ /opt/local/bin/mongod --dbpath=/opt/mongo-data/ | |
Wed Aug 19 21:45:10 Mongo DB : starting : pid = 6578 port = 27017 dbpath = /opt/mongo-data/ master = 0 slave = 0 32-bit | |
** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data | |
** see http://blog.mongodb.org/post/137788967/32-bit-limitations for more | |
Wed Aug 19 21:45:10 db version v0.9.8, pdfile version 4.4 | |
Wed Aug 19 21:45:10 git version: nogitversion | |
Wed Aug 19 21:45:10 sys info: Darwin aura.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 | |
Wed Aug 19 21:45:10 waiting for connections on port 27017 | |
Wed Aug 19 21:45:10 web admin interface listening on port 28017 | |
2) Compile the erlang driver then start the gen_server style driver by launching the script start.sh and enter the following commands to insert your first element in a test collection, withing a test database | |
22:55:05 ^master $ ./start.sh | |
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:true] | |
Eshell V5.7.2 (abort with ^G) | |
(mongo@aura)1> mongodb:start(mypool, "aura.local" ,27017). | |
{ok,<0.49.0>} | |
(mongo@aura)2> mongodb:database(mypool, "mytestdb"). | |
{mongodb_database,mypool,"mytestdb"} | |
(mongo@aura)3> Col1 = mongodb_collection:new(mypool, "mytestdb", "mytestcol"). | |
{mongodb_collection,mypool,"mytestdb","mytestcol"} | |
(mongo@aura)4> Col1:insert({obj,[{"name", "test"}]}). | |
{ok,{obj,[{"_id", | |
{oid,<<23,161,8,3,240,100,71,24,185,25,41,180>>}}, | |
{"name","test"}]}} | |
3) As a result in the other prompt you can see the following logged actions: | |
Wed Aug 19 22:55:56 connection accepted from 127.0.0.1:5365 #4 | |
Wed Aug 19 22:57:03 allocating new datafile /opt/mongo-data/mytestdb.0, filling with zeroes... | |
Wed Aug 19 22:57:03 done allocating datafile /opt/mongo-data/mytestdb.0, size: 67108864, took 0.132 secs | |
Wed Aug 19 22:57:06 building new index on { _id: ObjId(000000000000000000000000) } for mytestdb.mytestcol...done for 0 records | |
Wed Aug 19 22:57:02 insert mytestdb.mytestcol 3700ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment