Skip to content

Instantly share code, notes, and snippets.

@wetnun
Created January 13, 2010 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wetnun/276625 to your computer and use it in GitHub Desktop.
Save wetnun/276625 to your computer and use it in GitHub Desktop.
[root@ii83-2 (14:01:44) ~/mongodb-linux-i686-1.1.4/bin]# ./mongo
MongoDB shell version: 1.1.4
url: test
connecting to: test
type "help" for help
> use common
switched to db common
> db.createCollection("arrtest");
{ "ok" : 1 }
> j={"random":"some crap","tester":["test1","test2","test3"]}
{ "random" : "some crap", "tester" : [ "test1", "test2", "test3" ] }
> t={"crap":"this doesn't matter","tester":["test3"]}
{ "crap" : "this doesn't matter", "tester" : [ "test3" ] }
> db.arrtest.save(t);
> db.arrtest.find();
{ "_id" : ObjectId("4b4e432c03df0479067d9e98"), "random" : "some crap", "tester" : [ "test1", "test2", "test3" ] }
{ "_id" : ObjectId("4b4e436103df0479067d9e99"), "crap" : "this doesn't matter", "tester" : [ "test3" ] }
> db.arrtest.find({"_id":"4b4e432c03df0479067d9e98"});
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment