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

Mongodb Lab Viva Questions

Uploaded by

fareenahmed31
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Mongodb Lab Viva Questions

Uploaded by

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

MONGODB LAB VIVA

QUESTIONS
PRROGRAM 1:
1.What is the role of where clause ?
Ans: there is no direct equivalent to a traditional SQL WHERE clause
as you might find in relational databases.
2.What is insert method?
Ans: The insertion or adding the data to the database is know as insert
operator?
3.What is delete operator?
Ans: The delete operator is used to delete the specific document from
the inserted data .
4.What is update operator?
Ans: It is used to update or modify the data that is already stored in
database.
5.What does and operation do?
Ans: Is used to combine multiple conditions within a query to retrieve
documents that satisfy all specified conditions simultaneously.
6.What does or operation do?
Ans: the logical OR operation allows you to combine multiple
conditions within a query so that documents meeting any of the
specified conditions are returned.

PROGRAM 2:
1.Give the syntax for displaying data by ignoring some fields?
Ans: db.collection.find({}, { fieldToExclude1: 0, fieldToExclude2: 0,
... })
2.What does limit method do?
Ans: the limit() method is used to restrict the number of documents
returned in the result set of a query.
3.What does find method do?
Ans: the find() method is used to display the documents from a
collection.
4.What does pretty method do?
Ans: the pretty() method is used to format the output of query results
in a more readable and structured manner.
5.What is the goal of this program?
Ans: The goal of this program is to learn how to display the data by
ignoring some fields and how to use limit method.

PROGRAM 3:
1.What are comparison selectors?
Ans: comparison selectors are used within query operators to specify
conditions for selecting documents based on comparison operations.
2.What are logical selectors?
Ans: logical selectors or logical operators are used to combine
multiple conditions within a single query.
3.What are the logical operators used here?
Ans: and ,or and nor.
4.What are geospatial selectors?
Ans: geospatial selectors and operators are used to perform queries
that involve geographical data, specifically to find documents based
on their proximity to a specified geographical point or within a
defined geographic area.
5. What are bitwise selectors?
Ans: These operators enable querying and updating documents based
on specific bits or combinations of bits in integer fields.
6. List the bitwise operators?
Ans: bitsAllSet ,bitsAllClear ,bitsAnyClear ,bitsAnySet.
7.What is the goal of this program?
Ans: The goal of this program is to learn how to use comparison
selectors ,logical selectors ,geospatial operators and bitwise selectors.

PROGRAM 4:
1.What are projection operator?
Ans: projection operators are used within the $project stage of an
aggregation pipeline to reshape documents by specifying which fields
to include or exclude, renaming fields, or including computed fields.
2.What does $ do ?
Ans: the $ is used as a special character in various contexts,
particularly within the context of query operators and aggregation
pipeline stages.
3.what does elematch operator do?
Ans: It allows you to perform complex queries on array fields and
retrieve documents based on conditions applied to elements within
those arrays.
4. What does slice operator?
Ans: the $slice operator is used within the projection stage of an
aggregation pipeline to limit the number of elements returned in an
array field.
5.What are the projection operator is used here?
Ans: $,elematch and slice.
6.What is the goal of this program?
Ans: The goal of this program is that we are performing project
operations on review and getting the result.

PROGRAM 5:
1.Why aggregate operator are used ?
Ans: Aggregate operations are used to perform data transformation
and aggregation tasks on collections of documents.
2.What is avg operator?
Ans: Computes the average of numeric values for documents in a
group.
3.What does add to set operator do?
Ans: Adds unique values to an array only if they do not already exist
in the set.
4.What is min operator?
Ans: Finds the minimum value among the values of a specified field
across all documents in a group.
5.What is max operator?
Ans: Finds the maximum value among the values of a specified field
across all documents in a group.
6.What does push operator do?
Ans: It collects all values of a specified field across all documents in a
group into an array.
7.What is the goal of this program?
Ans: The goal of this program is to performing aggregate functions
and getting the result.

PROGRAM 6:
1.What do you mean by aggregate pipeline?
Ans: The aggregate pipeline is a framework for performing data
aggregation operations on collections.
2.What is match operator?
Ans: The $match operator filters documents to allow only those that
match specified criteria to pass through to the next stage of the
pipeline.
3.What does sort operator do?
Ans: It allows you to sort documents according to one or more fields
and specify ascending or descending order for each field.
4.Why is group operator is used?
Ans: The $group operator is used to group documents by specified
expressions and perform aggregation operations on the grouped data.
5.What is role of skip operator?
Ans: The $skip operator is used to skip a specified number of
documents from the beginning of the result set.
6.What is project operator?
Ans: the $project operator is used to reshape documents by including,
excluding, renaming, or adding fields.
7.What is goal of this program ?
Ans: The goal is to apply aggregate pipeline functions to the given
data.

PROGRAM 7:
1.What is an URL?
Ans: URL stands for Uniform Resource Locator. It is a reference to a
resource on the internet.
2.What are the aggregate functions used in program b?
Ans: unwind,group,sum,avg,push,project.
3.What is vacation rentals ?
Ans: We use to store and manage information about properties
available for short term stays.
4.What is exists function ?
Ans: function is used to determine whether documents matching a
specified condition exist in a collection.
5.Why MongoDb is a good choice for vacation rentals?
Ans: Because, it provides flexible,scalable and performant solution
for managing property data and user interaction.
6.What does unwind do?
Ans: the $unwind operator is used to deconstruct an array field from
the input documents to output a document for each element.
7.What is the goal of this program a?
Ans: Find all listings with listing_url, name, address, host_picture_url
in the listings And Reviews collection that have a host with a picture
url.

PROGRAM 8:
1.What is unique index?
Ans: A unique index in MongoDb ensures that the index fields do not
store duplicate values.
2.What is sparse index?
Ans: A sparse index in MongoDb is that only includes documents in
the index if the index field contains a value.
3.What is multikey index?
Ans: A multikey index in MongoDb is an index type used to array
fields.
4. What is compound index?
Ans: A compound index in MongoDb is an index that includes
multiple fields .
5.Why we use query optimization in MongoDb?
Ans: Optimization in MongoDb is crucial to ensure that the database
performs efficiently and can handle large volume of data.
6.Why optimization is important in MongoDb?
Ans: Optimization provides performance improvement ,resource
management ,scalability, cost efficiency ,user experience.
7.Define create collection method in MongoDb?
Ans: The create Collection method in MongoDb is used explicitly
create a new collection with specific options.

PROGRAM 9:
1.What is text searching using catalog data?
Ans: Performing an extended search using catalog data in MongoDB
typically involves querying documents in a collection based on
various criteria such as text search, filters, and possibly sorting or
pagination.
2.Give syntax for searching?
Ans: db.collection.find({ $text: { $search: "search query" } })
3.What is search operator?
Ans: The $search operator is used as part of the $text query operator
to perform full-text search operations. This operator allows you to
search for text within indexed fields in your collections.
4.What is the goal of this program?
Ans: The goal of this program is to learn how to search a text using
catalog data given.

PROGRAM 10:
1.Give syntax for searching?
Ans: db.collection.find({ $text: { $search: "search query" } })
2.What is search operator?
Ans: The $search operator is used as part of the $text query operator
to perform full-text search operations. This operator allows you to
search for text within indexed fields in your collections.
3.What is the goal of this program?
Ans: The goal of this program is to learn how to search a text using
catalog data given with aggregate pipeline.
4.Give the syntax for creating an idex?
Ans: db.collection.createIndex(keys, options)

You might also like