Skip to content

Instantly share code, notes, and snippets.

@rtomaszewski
Last active Dec 31, 2015
Embed
What would you like to do?
# extract the hw1 archive file
# change to the directory
$ ls
root@mongo2:~/hw1# ls -la
total 24
drwxrwxr-x 3 root root 4096 Dec 18 23:57 .
drwxr-xr-x 11 root root 4096 Dec 18 23:57 ..
drwxr-xr-x 3 root root 4096 Feb 12 2013 dump
-rw-r--r-- 1 root root 598 Mar 27 2013 hw1-2.py
-rw-r--r-- 1 root root 2584 Dec 18 23:51 hw1-2.py.html
-rw-r--r-- 1 root root 745 Dec 18 23:57 hw1-3.py
$ mongorestore
$ mongo
> show dbs
> show collections
> use m101
> db.funnynumbers.find().sort( {value:1 } )
{ "_id" : ObjectId("50778ce69331a280cf4bcfa2"), "value" : 0 }
{ "_id" : ObjectId("50778ce69331a280cf4bcfbe"), "value" : 0 }
{ "_id" : ObjectId("50778ce69331a280cf4bcf8f"), "value" : 1 }
{ "_id" : ObjectId("50778ce69331a280cf4bcfb2"), "value" : 1 }
{ "_id" : ObjectId("50778ce69331a280cf4bcfc0"), "value" : 2 }
{ "_id" : ObjectId("50778ce69331a280cf4bcfda"), "value" : 2 }
> db.hw1.find()
{ "_id" : ObjectId("50773061bf44c220307d8514"), "answer" : 42, "question" : "The Ultimate Question of Life, The Universe and Everything" }
> db.funnynumbers.drop()
> db.dropDatabase()
{ "dropped" : "m101", "ok" : 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment