NoSQL Interview Questions and Answers for 2020

  • date 18th November, 2019 |
  • by Prwatech |


NoSQL Interview Questions and Answers

NoSQL Interview Questions and Answers, Are you looking for the list of top Rated NoSQL Interview Questions and Answers? Or the one who is casually looking for the Best Platform which is offering Best interview questions on NoSQL? Or the one who is carrying experience seeking the List of best NoSQL Interview Questions and Answers for experienced then stays with us for the most asked interview questions on NoSQL which are asked in the most common interviews.

We’re India’s Leading E-learning platform for Big Data offering Advanced Big Data certification Course to All our students who Enrolled with us. Get certified and learn the Course under 15+ Years of certified professionals of Our Big Data Training Institute in Bangalore from Today itself.


1) Write down the differences between NoSQL and RDBMS?

Ans Following is a list of the differences between NoSQL and RDBMS: –
In terms of data format, NoSQL does not follow any order for its data format. Whereas, RDBMS is more organized and structured when it comes to the format of its data.
When it comes to scalability, NoSQL is more very good and more scalable. Whereas, RDBMS is average and less scalable than NoSQL.
For querying of data, NoSQL is limited in terms of querying because there is no join clause present in NoSQL. Whereas, querying can be used in RDBMS as it uses the structured query language.
The difference in the storage mechanism of NoSQL and RDBMS, NoSQL uses key-value pairs, documents, column storage, etc. for storage. Whereas, RDBMS uses various tables for storing data and relationships.


2) What do you understand by NoSQL in databases?

The database management systems which are highly scalable and flexible are known as NoSQL databases. These databases allow us to store and process unstructured and semi-structured data which is not possible when we make use of the Relational database management system. NoSQL can be termed as a solution to all the conventional databases which were not able to handle the data seamlessly. It also gives an opportunity to the companies to store massive amounts of structured and unstructured data in real-time. In today’s time, big firms such as- Google, Facebook, Amazon, etc. use NoSQL for providing cloud-based services for storing data in real-time.


3) List some of the features of NoSQL?

Some of the features of NoSQL are listed below: –
Using NoSQL, we can store a large amount of structured, semi-structured, and unstructured data.
It supports agile sprint, quick iteration, and frequent code pushes.
It uses object-oriented programming which is frequent and is also easy to use.
It is more efficient. It has a scale-out architecture. It is cheap instead of being expensive. It has a monolithic architecture. It can be easily accessed.

Apache Spark SQL commands Tutorial & Programming Guide


4) What do you understand by ” Polyglot Persistence ” in NoSQL?

The term Polyglot Persistence was coined by Neal Ford in 2006 to express the idea that applications should be written in mixed languages. As we all know that different problems arise in all the applications. So, when an application is written using different languages, then those languages can be used to solve or tackle with different kinds of problems. This is known as polyglot persistence. Picking the right language for a particular problem can be more productive rather than trying to fit all the aspects of that problem into a single language. Hence, polyglot persistence is the term which is used to define this hybrid approach to persistence.


5) How does the NoSQL database management system budget memory?

The node which manages the data in the NoSQL database store is the replication node. It is also the main consumer of memory. The java heap and the cache size which are used by the replication node are the important factors in terms of performance. By default, these two things are calculated by NoSQL in terms of the amount of memory available to the storage node. Specification of the available memory for a storage node is recommended. The memory will be evenly divided between all the RN’s if the storage node hosts more than one replication node.


6) Explain the Oracle NoSQL database management system?

The NoSQL database management system is a distributed key-value database. It is designed so that it can provide highly reliable and scalable data. It can make the data storage available across all the configurable set of systems that function as storage nodes. In this database system, data is stored as key-value pairs. This data is written to a particular storage node. These databases provide a mechanism for the storage and retrieval of data which is composed in a way other than the tabular method which was used in relational databases.


7) What are the pros and cons of a graph database under NoSQL databases?

Following are the pros and cons of a graph database which is a type of NoSQL databases: –
Pros of using graph database:
These are tailor-made for networking applications. A social network is a good example of this.
They can also be perfect for an object-oriented programming system.
Cons of using graph database:
Since the degree of interconnection between nodes is high in the graph database, so it is not suitable for network partitioning.
Also, graph databases don’t scale out well in NoSQL databases.


8) List the different kinds of NoSQL data stores?

The variety of NoSQL data stores available which are widely distributed are categorized into four categories. They are: –
Key-value store– it is a simple data storage key system that uses keys to access different values.
Column family store– it is a sparse matrix system. It uses columns and rows as keys.
Graph store– it is used in case of relationships-intensive problems.
Document stores- it is used for storing hierarchical data structures directly in the database.


9) What is the CAP Theorem? How is it applicable to NoSQL systems?

The CAP theorem was proposed by Eric Brewer in early 2000. In this, three system attributes have been discussed within the distributed databases. That is-
Consistency- in this, all the nodes see the same data at the same time.
Availability- it gives us a guarantee that there will be a response for every request made to the system about whether it was successful or not.
Partition tolerance- it is the quality of the NoSQL database management system which states that the system will work even if a part of the system has failed or is not working.
A distributed database system might provide only 2 of the 3 above qualities.


10) What do you mean by eventual consistency in NoSQL stores?

Eventual consistency in NoSQL means that when all the service logics have been executed, the system is left in a consistent state. For achieving high availability, this concept is used in the distributed systems. It gives a guarantee that, if new updates are not made to a given data item, then eventually all accesses to that item will return the last updated value. In NoSQL, it is provided in terms of BASE and RDMS are also known as the ACID properties. Present NoSQL databases provide client applications with a guarantee of eventual consistency. Some NoSQL databases like- MongoDB and Cassandra are eventually consistent in some of the configurations.


11) What are the different types of NoSQL databases? Give some examples.

NoSQL database can be classified as 4 basic types:

1. Key-value store NoSQL database
2.Document store NoSQL database
3.Column store NoSQL database
4. Graph-based NoSQL database

There are many NoSQL databases. MongoDB, Cassandra, CouchDB, Hypertable, Redis, Riak, Neo4j, HBase, Couchbase, MemcacheDB, Voldemort, RevenDB, etc. are examples of NoSQL databases.


12) Is MongoDB better than other SQL databases? If yes then how?

MongoDB is better than other SQL databases because it allows a highly flexible and scalable document structure.

For example:
One data document in MongoDB can have five columns and the other one in the same collection can have ten columns.
MongoDB database is faster than SQL databases due to efficient indexing and storage techniques.


13) What type of DBMS is MongoDB?

MongoDB is a document-oriented DBMS


14) What is the difference between MongoDB and MySQL?

Although MongoDB and MySQL both are free and open-source databases, there is a lot of difference between them in terms of data representation, relationship, transaction, querying data, schema design and definition, performance speed, normalization and many more. To compare MySQL with MongoDB is like a comparison between Relational and Non-relational databases.


15) Why MongoDB is known as the best NoSQL database?

MongoDB is the best NoSQL database because it is:

1. Document Oriented
2. Rich Query language
3. High Performance
4. Highly Available
5. Easily Scalable


16) Does MongoDB support primary-key, foreign-key relationships?

No. By default, MongoDB doesn’t support the primary key-foreign key relationship.


17) Can you achieve primary key – foreign key relationships in MongoDB?

We can achieve the primary key-foreign key relationships by embedding one document inside another. For example, An address document can be embedded inside the customer documents.


18) Does MongoDB need a lot of RAM?

No. There is no need for a lot of RAM to run MongoDB. It can be run even on a small amount of RAM because it dynamically allocates and deallocates RAM according to the requirement of the processes.


19) Explain the structure of ObjectID in MongoDB.

ObjectID is a 12-byte BSON type. These are:

1. 4 bytes value representing seconds
2. 3-byte machine identifier
3. 2-byte process id
4.3 byte counter


20) Is it true that MongoDB uses BSON to represent document structure?



21) What are Indexes in MongoDB?

In MongoDB, Indexes are used to execute queries efficiently. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect.


22) By default, which index is created by MongoDB for every collection?

By default, the_id collection is created for every collection by MongoDB.


23) What is a Namespace in MongoDB?

A namespace is a concatenation of the database name and the collection name. Collection, in which MongoDB stores BSON objects.

24) Can journaling features be used to perform safe hot backups?



25) Why does Profiler use it in MongoDB?

MongoDB uses a database profiler to perform characteristics of each operation against the database. You can use a profiler to find queries and write operations


26) If you remove an object attribute, is it deleted from the database?

Yes, it is. Remove the attribute and then re-save() the object.


27) In which language MongoDB is written?

MongoDB is written and implemented in C++.


28) Does MongoDB need a lot of space for Random Access Memory (RAM)?

No. MongoDB can be run on a small free space of RAM.


29) What language you can use with MongoDB?

MongoDB client drivers support all the popular programming languages so there is no issue of language, you can use any language that you want.


30) Does MongoDB database have tables for storing records?

No. Instead of tables, MongoDB uses “Collections” to store data.


31) Do the MongoDB databases have a schema?

Yes. MongoDB databases have a dynamic schema. There is no need to define the structure to create collections.


32) What is the method to configure the cache size in MongoDB?

MongoDB’s cache is not configurable. Actually MongoDB uses all the free spaces on the system automatically by way of memory-mapped files.


33) How to do Transaction/locking in MongoDB?

MongoDB doesn’t use traditional locking or complex transaction with Rollback. MongoDB is designed to be lightweight, fast and predictable to its performance. It keeps transaction support simply to enhance performance.


34) Why 32-bit version of MongoDB is not preferred?

Because MongoDB uses memory-mapped files so when you run a 32-bit build of MongoDB, the total storage size of the server is 2 GB. But when you run a 64-bit build of MongoDB, this provides virtually unlimited storage size. So 64-bit is preferred over 32-bit.


35) Is it possible to remove old files in the moveChunk directory?

Yes, these files can be deleted once the operations are done because these files are made as backups during normal shard balancing operations. This is a manual cleanup process and necessary to free up space.


36) What will have to do if a shard is down or slow and you do a query?

If a shard is down and you even do the query, then your query will be returned with an error unless you set a partial query option. But if a shard is slow them Mongos will wait for them till response.


37)Explain the covered query in MongoDB.

A query is called a covered query if satisfies the following two conditions:
The fields used in the query are part of an index used in the query.
The fields returned in the results are in the same index.


38) What is the importance of covered queries?

Covered query makes the execution of the query faster because indexes are stored in RAM or sequentially located on disk. It makes the execution of the query faster.
Covered query makes 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.


39) What is sharding in MongoDB?

In MongoDB, Sharding is a procedure of storing data records across multiple machines. It is a MongoDB approach to meet the demands of data growth. It creates a horizontal partition of data in a database or search engine. Each partition is referred to as a shard or database shard.


40) What is a replica set in MongoDB?

A replica can be specified as a group of mongo instances that host the same data set. In a replica set, one node is primary, and the other is secondary. All data is replicated from primary to secondary nodes.


41) What is the primary and secondary replica set in MongoDB?

In MongoDB, primary nodes are the nodes that can accept write. These are also known as master nodes. The replication in MongoDB is a single master so, only one node can accept write operations at a time.
Secondary nodes are known as slave nodes. These are read-only nodes that replicate from the primary.


42) By default, which replica sets are used to write data?

By default, MongoDB writes data only to the primary replica set.


43) What is CRUD in MongoDB?

MongoDB supports following CRUD operations:

1. Create
2. Read
3. Update
4. Delete


44) In which format MongoDB represents document structure?

MongoDB uses BSON to represent document structures.


45) What will happen when you remove a document from the database in MongoDB? Does MongoDB remove it from disk?

Yes. If you remove a document from the database, MongoDB will remove it from disk too.


46) Why are MongoDB data files large in size?

MongoDB doesn’t follow file system fragmentation and pre-allocates data files to reserve space while setting up the server. That’s why MongoDB data files are large in size.


47) What is a storage engine in MongoDB?

A storage engine is the part of a database that is used to manage 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.


48) Which are the storage engines used by MongoDB?

MMAPv1 and WiredTiger are two storage engines used by MongoDB.


49) What is the usage of profiler in MongoDB?

A database profiler is used to collect data about MongoDB write operations, cursors, database commands on a running MongoDB instance. You can enable profiling on a per-database or per-instance basis.

The database profiler writes all the data it collects to the system. profile collection, which is a capped collection.


50) Is it possible to configure the cache size for MMAPv1 in MongoDB?

No. it is not possible to configure the cache size for MMAPv1 because MMAPv1 does not allow configuring the cache size.


Quick Support

image image