100% found this document useful (1 vote)
151 views

Lab Assignment1 Mongodb

The document provides a sample employee document to insert into a database collection, along with questions to query and display data from the collection in various formats. Specifically, it inserts a document with employee details like name, ID, age, salary, etc. and provides questions to display documents, names, names and ages, details for employees matching certain criteria, and more.

Uploaded by

ANKIT MITTAL
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
151 views

Lab Assignment1 Mongodb

The document provides a sample employee document to insert into a database collection, along with questions to query and display data from the collection in various formats. Specifically, it inserts a document with employee details like name, ID, age, salary, etc. and provides questions to display documents, names, names and ages, details for employees matching certain criteria, and more.

Uploaded by

ANKIT MITTAL
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1) Create a database

Create a Collection in the same database

Q2 .Insert a document into the collection.

Ans.

employee ({

eid:107,

ename:"ss",

age:39,

gender:"M",

salary:55400,

job:"sales_man",

phone:9167843678,

address:{houseno:101,

city:"indirapuram",

state:"up",

zip:112876},

deptno:20})

Q3. Display the documents in that collection in a good format.

Q4.Display the name of all employees

Q5.Display the name and age of all employees.

Q6.Display the name and age of all employees but not their ids.

Q7..Display the details of employees whose name is x

Q8.Display name and age of the employees whose name is x

9. Display the name,age and salaryof all employees whose salary is greater than
50,000.
10 . Display the details of all female employees

11. Display the name and job and dept_num of all female employees who is not 30 till
now year old.(and )

12. Display the details of all female employees who works in dept_num=30 or 20.(OR
operator)

13. Display the name and id of all employees who works in ($IN operator)

14.Display detail of employees who comes under the age group 30-35

You might also like