You are on page 1of 3

Subject Code: PUSDSBA502

Next Generation Database


B.Sc. Sem V
Time: 2 hours Total Marks: 50 marks

Note:
1. The candidate has option to either attempt question 3 or question 4.
2. Numbers to the right indicate full marks.
3. Use of approved scientific calculator is allowed.
4. Additional 20 minutes will be provided after the examination to submit the answers

Q1) 15 Marks

Q1A. Write a query to create collection names employees, That can accept only 100 5 Marks
employees , make use of field validators.
Q1B Write query to shrad a db.Expain Significance of shrad key. 5 Marks
Q1C What is aggregate pipeline and its stages? 5 Marks

Write a query that returns employee department with count in ascending order
of department names.

Q2) What is significance of _id. 15 Marks


Write a query to assign ‘123’ to _id?
Can we have duplicate entries with same _id? Justify your answer
Q2A. Write queries to delete a document, a collection and a database 5 Marks
Q2B Create a collection of your choice having only 2 simple documents (3 fields). 5 Marks
Demonstatre the difference between
.findOneAnd Replace() vs. .updateOne()
Q2C What are atomic operators in Mongodb. List them down with use. 5 Marks

Attempt Q3 OR Q4 15 Marks

Q3A. Create a database of movies. Create collection to accept only 100 enteries. 20 Marks
Also the collection should have fields, that compulsary have director name and
emailID, moviename cannot exceed 100 charecters.

Explain the syntax to add new data into collection. Add 10 enetries into the
collection . eg-
{
... "actor id":1,
... fname:"aamir",lname:"khan",
... address:[
... {street:"wall street"},
... {city:"new york"},

Page 1 of 3
... {state:"mid state"},
... {country:"usa"},
... {pincode:"62201"}
... ],
... "contact details":[
... {emailid:"sallu@gmail.com"},
... {phonene:"12345678"}
... ]
... },
... {
... "actor id":2,
... fname:"aamir",lname:"khan",
... address:[
... {street:"wall street"},
... {city:"new york"},
... {state:"mid state"},
... {country:"usa"},
... {pincode:"62201"}
... ],
... "contact details":[
... {emailid:"sallu@gmail.com"},
... {phonene:"12345678"}
... ]
... },

Write a querry to find all the releases made in Mumbai

Write a query that shows list of amir khan movies released in current year

Delete the film " 3 Idiots".

Write the aggregate query that groups the data based on actors, gives count of
movies, and sort them in an order.

Q4A. Create database EMP and Make Collection With name "EMPL" 20 Marks

Insert Records Into EMPL Collection


Eg-
db.empl.insert([
{no:1,name:"ST",salary:2000,role:"OB"},
{no:2,name:"MSD",salary:1500,role:"WK"},
{no:3,name:"YS",salary:1000,role:"ALR"},
{no:4,name:"RD",salary:1000,role:"MOB"},
{no:5,name:"RS",salary:500,role:"OB"},
{no:6,name:"BK",salary:500,role:"MOB"},

Page 2 of 3
{no:7,name:"VK",salary:300,role:"BW"},
{no:8,name:"JB",salary:400,role:"BW"},
{no:9,name:"HP",salary:400,role:"ALR"},
{no:10,name:"VS",salary:300,role:"OB"}])
Display Data in Proper Format

Update Salary Of Employee where Name is "ST" by +8000

Update Salary Of All Employee by giving an increment of +4000 each

update role of "MSD" as "C and WK"

Add a New Field remark to document with name "RS" set Remark as WC

Add a New Field As Number 11,name AK,Salary 10000,role coch without


using insert statement. But for Doing So You should have a Record Added
woth number 11.

remove added New Field

Update the Field "RD" by multiplying with salary by 2

To Find Document From the empl collection where name begins with S

Display Documents where in empl collection Field have OB,MOB

Display Documents where in empl collection Field have OB,MOB

Page 3 of 3

You might also like