Homework 1.1
Download and install MongoDB from www.mongodb.org. Then run the database as a single server instance on your PC (that is, run the mongod binary). Then, run the administrative shell.From the shell prompt type
db.isMaster().maxBsonObjectSize
at the ">" prompt.
What do you get as a result?
What do you get as a result?
16777216
Homework 1.2
Download the file products.json from education.mongodb.com. Take a look at its content.
Now, import its contents into MongoDB, into a database called "pcat" and
a collection called "products". Use the mongoimport utility to do
this.
mongoimport --host localhost --port 27017 --db pcat --collection products --file "products.json" --drop
When done, run this query in the mongo shell:
db.products.find({type:"case"}).count()
What's the result?
3
Homework 1.3
At this point you should have pcat.products loaded from the previous step. You can confirm this by running in the shell:> db.products.find() > // or: > db.products.count() > // should print out "11"
Now, what query would you run to get all the products where brand equals the string “ACME”?
db.products.find({"brand": "ACME"})
No hay comentarios:
Publicar un comentario