Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

MongoDB Interview Questions and Answers For Freshers Part-3

Be First!

mongodb21.What is a covered query in MongoDB?
A covered query is the one in which:

fields used in the query are part of an index used in the query, and
the fields returned in the results are in the same index

22.Why is a covered query important?
Since all the fields are covered in the index itself, MongoDB can match the query condition as well as return the result fields using the same index without looking inside the documents. Since indexes are stored in RAM or sequentially located on disk, such access is a lot faster.

23.Does MongoDB provide a facility to do text searches? How?
Yes. MongoDB supports creating text indexes to support text search inside string content. This was a new feature which can introduced in version 2.6.

24.What happens if an index does not fit into RAM?
If the indexes do not fit into RAM, MongoDB reads data from disk which is relatively very much slower than reading from RAM.

25.Mention the command to list all the indexes on a particular collection.

26.At what interval does MongoDB write updates to the disk?
By default configuration, MongoDB writes updates to the disk every 60 seconds. However, this is configurable with the commitIntervalMs and syncPeriodSecs options.

27.How can you achieve transaction and locking in MongoDB?
To achieve concepts of transaction and locking in MongoDB, we can use the nesting of documents, also called embedded documents. MongoDB supports atomic operations within a single document.

28.What is Aggregation in MongoDB?
Aggregations operations process data records and return computed results. Aggregation operations group values from multiple documents together, and can perform a variety of operations on the grouped data to return a single result. MongoDB provides three ways to perform aggregation: the aggregation pipeline, the map-reduce function, and single purpose aggregation methods and commands.

29.What is Sharding in MongoDB? Explain.
Sharding is a method for storing data across multiple machines. MongoDB uses sharding to support deployments with very large data sets and high throughput operations.

30.What is Replication in MongoDB? Explain.
Replication is the process of synchronizing data across multiple servers. Replication provides redundancy and increases data availability. With multiple copies of data on different database servers, replication protects a database from the loss of a single server. Replication also allows you to recover from hardware failure and service interruptions.



Leave a Reply