0% found this document useful (0 votes)
7 views

Assignment-3(2)

The document outlines assignments focused on CRUD operations for two collections: 'College' and 'Movie', as well as 'Company' and 'Transaction'. It includes tasks such as updating, inserting, displaying, and deleting documents within these collections, with specific criteria for the data entries. Additionally, it provides a set of queries for manipulating data in a student collection with embedded documents.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Assignment-3(2)

The document outlines assignments focused on CRUD operations for two collections: 'College' and 'Movie', as well as 'Company' and 'Transaction'. It includes tasks such as updating, inserting, displaying, and deleting documents within these collections, with specific criteria for the data entries. Additionally, it provides a set of queries for manipulating data in a student collection with embedded documents.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment No.

3:- Assignment on CRUD Operations for Created Collections


Practice Set:
For a collection “College” created in a database containing documents with fields
{College_id, College_name, Faculty, Subjects, Salary}
With multiple documents
1. Update subject allocated to given faculty
2. Increase salary by Rs. 1000 of all faculty
3. Display all updated documents

Set A:
1. Create a database with the name ‘Movie’.
A ‘Film’ is a collection of documents with the following fields:
a. Film Id
b. Title of the film
c. Year of release
d. Genre / Category (like adventure, action, sci-fi, romantic etc.) A film can belong to
more than one genre.
e. Actors (First name and Last name)
f. Director (First name and Last name)
g. Release details (It consists of places of release, dates of release and rating of the film.)

3.An ‘Actor’ is a collection of documents with the following fields:


a. Actor Id
b. First name
c. Last Name
d. Address (Street, City, State, Country, Pin-code)
e. Contact Details (Email Id and Phone No)
f. Age of an actor.

Queries:
1. Insert at least 10 documents in the collection Film – a. Insert at least one document
with film belonging to two genres.
b. Insert at least one document with film that is released at more than one place and on
two different dates.
c. Insert at least three documents with the films released in the same year.
d. Insert at least two documents with the films directed by one director.
e. Insert at least two documents with films those are acted by a pair ‘Madhuri Dixit’ and
‘Shahrukh Khan’.

2. Insert at least 10 documents in the collection Actor.

Make sure, you are inserting the names of actors who have acted in films, given in the ‘Film’
collection.
3. Display all the documents inserted in both the collections.
4. Add a value to the rating of the film whose title starts with ‘T’.
5. Add an actor named " " in the ‘Actor’ collection. Also add the details of the film in ‘Film’
collection in which this actor has acted in.
6. Delete the film " ".
7. Delete an actor named " ".
8. Delete all actors from an ‘Actor’ collection who have age greater than “ ”
9. Update the actor’s address where Actor Id is “ ”.
10. Update the genre of the film directed by “ ”.

Set B:

1. Create a database with name ‘Company’.


2. An ‘Employee’ is a collection of documents with the following fields: a. Employee ID
b. First Name
c. Last Name
d. Email
e. Phone No.
f. Address (House No, Street, City, State, Country, Pin-code)
g. Salary
h. Designation
i. Experience
j. Date of Joining
k. Birthdate

3. A ‘Transaction’ is a collection of documents with the following fields: a. Transaction


Id,
b. Transaction Date
c. Name (First Name of employee who processed the transaction)
d. Transaction Details (Item Id, Item Name, Quantity, Price)
e. Payment (Type of Payment (Debit/Credit/Cash), Total amount paid, Payment
Successful)
f. Remark (Remark field can be empty.)
Queries:

1. Insert at least 5 documents in ‘Employee’ collection.


2. Insert multiple documents (at least 10) into the ‘Transaction’ collection by passing an
array of documents to the db.collection.insert () method.
3. Display all the documents of both the collections in a formatted manner.
4. Update salary of all employees by giving an increment of Rs. 4000.
5. Update the remark for transaction id 201.
6. Update designation of an employee named “_ ” from supervisor to manager.
7. Update designation of an employee having Employee Id as .
8. Change the address of an employee having Employee Id as .
9. Delete transaction made by “ ” employee on the given date. 10.Delete all the
employees whose first name starts with ‘K’.

Set C:
Consider the following document in the students collection whose grades element value
is an array of embedded documents:
{
_id: 4,
grades: [ 36
{ grade: 80, mean: 75, std: 8 },
{ grade: 85, mean: 90, std: 5 },
{ grade: 85, mean: 85, std: 8 }
]
}
1. Update the std field of the first array element that matches the grade equal to 85
2. Delete array element with grade 80

You might also like