MongoDB Interview Questions
1: What are NoSQL databases? What are the different types of NoSQL databases?
2: How to do transactions/locking in MongoDB?
MongoDB does not use conventional locking with reduction, as it is planned to be light, high-speed and knowable in its presentation. It can be considered as parallel to the MySQL MyISAM auto entrust sculpt. With simplest business sustain, performance is enhanced, particularly in a structure with numerous servers.
3: Most important features of MongoDB?
4: What is a Namespace in MongoDB?
MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the collection. The concatenation of the collection name and database name is called a namespace.
5: Explain how MongoDB is better than other SQL databases?
MongoDB allows a highly flexible and scalable document structure. For e.g. one data document in MongoDB can have five columns and the other one in the same collection can have ten columns. Also, MongoDB database are faster as compared to SQL databases due to efficient indexing and storage techniques.
6: Does MongoDB support foreign key constraints? How can you achieve primary key - foreign key relationships in MongoDB?
No. MongoDB does not support such relationships.
By default MongoDB does not support such primary key - foreign key relationships. However, we can achieve this concept by embedding one document inside another. Foe e.g. an address document can be embedded inside customer document.
7: Does MongoDB support ACID transaction management and locking functionalities?
No. MongoDB does not support default multi-document ACID transactions. However, MongoDB provides atomic operation on a single document.
8: Explain the structure of ObjectID in MongoDB.
9: What are Indexes in MongoDB?
10: 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.
11: What is Sharding in mongodb?
12: What is Replication in MongoDB? Explain.
13: What are Primary and Secondary Replica sets?
14: Why MongoDB is not preferred over a 32-bit system?
15: What is a Storage Engine in MongoDB?
A storage engine is the part of a database that is responsible for managing how data is stored on disk. For example, one storage engine might offer better performance for read-heavy workloads, and another might support a higher-throughput for write operations.
16: What is the role of a profiler in MongoDB? Where does the writes all the data?