Friday, 27 September 2019

MongoDB Questions and Answers for beginners

MongoDB Questions and Answers for beginners

Question: What kind of NoSQL database used in MongoDB?
MongoDB is a document oriented database. It store data in form of BSON structure.



Question: What is a Namespace in MongoDB?
Namespace is concatenation of the database name and collection name.



Question: Does MongoDB support foreign key constraints?
No.



Question: Does MongoDB support ACID transaction?
No.



Question: Does MongoDB support Indexes?
Yes.



Question: Does MongoDB support primary key & foreign key relationships in MongoDB?
No, By Default it does not support. But we can achieve this by using embedding one document inside another.



Question: How is MongoDB better than other SQL databases?
Namespace is concatenation of the database name and collection name.
  1. Highly flexible
  2. Scalable Document
  3. Fast
  4. Replication



Question: When we removed an document. Does it removed permanently?.
Yes, When we rmoved and document it delete from disk.


Question: When we removed an document. Does it removed permanently?.
Yes, When we rmoved and document it delete from disk.


Question: What happens if an index does not fit into RAM?.
In that case MongoDB reads data from disk which is relatively very much slower.


Question: What is a covered query in MongoDB?.
Covered query is the one in which, A) fields used in the query are part of an index
AND
B) the fields returned in the results are in the same index.


Question: What is Aggregation in MongoDB??.
Aggregation is process of data-records and return computed results.


Question: What is Sharding in MongoDB??.
Sharding is a method for storing data across multiple machines (2 OR more machines).


Question: What is Replication in MongoDB?.
Replication is a process of synchronizing data across multiple servers.


Question: What are Primary and Secondary Replica sets?
Primary and master nodes are the nodes that can accept writes.
Secondary and slave nodes are read-only nodes that replicate from the primary.


Question: Why are MongoDB data files large in size?
MongoDB preallocates data files to reserve space and avoid file system fragmentation when you setup the server.


Question: What is a Storage Engine in MongoDB?
A storage engine is responsible for managing data like how data is stored on disk.


Question: What are two storage engines used by MongoDB?
1) MMAPv1
2) WiredTiger


Question: Why MongoDB is not preferred over a 32-bit system??
In 32-bit build system the total storage size for the server including data and indexes is 2GB.


Question: What is the role of a profiler in MongoDB??
The Profiler collects fine grained data about MongoDB write operations, cursors, database commands.


Question: How does MongoDB provide concurrency?
MongoDB uses reader-writer locks for the concurrency.


Question: What is hotfix for windows?
A hotfix is single/cumulative package to fix an issue.


Question: How to changes in storage path of MongoDB?
mongod --dbpath "d:\mongodb\data"



Question: How to get mongoDB Version ?
mongod --version