Sunday, March 29, 2015

M102: MONGODB FOR DBAS - Homework 2.3

Step 1:
execute below query in mongo shell
> db.products.find({"limits.voice":{$exists:1}}).count()

you will get your answer as 3

M102: MONGODB FOR DBAS - Homework 2.2


Step 1:
Now you need to add product in products collection

you  need to update the id
_id : ObjectId("507d95d5719dbef170f15c00")


with following

term_years to  3
over_rate  for sms in limits to 0.01 from 0


Execute below Query in mongoshell

var temp = db.products.findOne({_id:ObjectId("507d95d5719dbef170f15c00")})

temp.term_years = 3

db.products.update({_id:temp._id},temp)

temp.limits.sms.over_rate = 0.01

db.products.update({_id:temp._id},temp)








Check your answer:

by executing homework.b()

you will get your answer as
0.050.019031


M102: MONGODB FOR DBAS - homework 2.1

Step 1:
Download the handout from

you will see homework2.js








Step 2:
import homework2.js
using
mongo --shell pcat homework2.js

Step 3:
on mongo shell type
>homework.a()

you will get your answer as 3.05


M102: MONGODB FOR DBAS - Homework 1.4

Step 1:
Check all the query in mongodb shell

Step 2:
you will observe that it is giving sorted result for


M102: MONGODB FOR DBAS HOMEWORK - HOMEWORK 1.3

Step 1:
> use pcat

Step 2:
> db.products.find({'brand':'ACME'})


Saturday, March 28, 2015

M102: MongoDB for DBAs - Week 1 - Homework 1.2

Step 1:

Download the products.json

Step 2:

Import products.json using below command
mongoimport -d pcat -c products --type json --file C:\products.json





Step 3:

execute below steps
> use pcat
> db.products.find({type:"case"}).count()

Answer you will get is 3


M102: MongoDB for DBAs homework 1.1

Step 1:
Execute Mongo  Command   db.isMaster().maxBsonObjectSize in shell
you will get output as


Answer is 16777216