×

Top 25 MongoDB interview Questions for 2024

1) Give some history about MongoDB.

MongoDB came into existence when data increased exponentially on the internet. Thus, maintainence of database became very difficult in structured DB. MongoDB is a NoSQL (Not Only SQL) database which can handle and sort all type of unstructured and complicated data.

2) Write some advantages of MongoDB over other database.

MongoDB is a document type database which is a type of NoSQL database which provides:
  • High performance
  • High availability
  • Easy Scalability
  • Rich Query Language

3) What is "Namespace" in MongoDB?

MongoDB uses BSON (Binary interchange & Structure Object Notation) which stores object in collection. Thus, Namespace is the concatenation of Collection name and Database name.

4) Explain the use of Locks to maintain consistency.

MongoDB uses reader-writer Locks which allows multiple users to access and apply READ operation on database or collection. It only allows single WRITE operation for private access which helps in maintaining consistency.

5) Define "Sharding" in MongoDB.

Sharding is a process in which data is stored across multiple machines. It creates a horizontal partition in database where each partition is referred as database shard.

6) What is a Replica Set?

It is a group of Mongo instances that maintains same data set. Replica set provides redundancy and consists of two nodes "Primary Node" and "Secondary Node" within which all data replicates.

7) Explain the process to move old files into moveChunk directory?

It is acheive at a time of shard balancing when the functions are done then old files are converted to backup files and moved to moveChunk directory.

8) Does MongoDB support primary-key, foreign key relationship? If not, how can we achieve it?

By default, MongoDB doesnot support primary-key, foreign key relationship but we can achieve it by embedding one document into other document.

9) Write the syntax for Create and Drop Collection?

Create Collection syntax:
db.createCollection(name,options)
Delete Collection syntax:
db.collection.drop()

10) How to use schema in MongoDB database?

MongoDB database has dynamic schema where we don't have to define the structure to create collections.

11) What is object composed of?

Object is composed of
  • Timestamp
  • Client machine ID
  • Client process ID
  • 3 byte incremented counter

12) Explain Indexes in MongoDB.

It is a special structure in MongoDB which allows easy traversing for small set of data. It consists of order by value for specific field. Index stores the value of specific set of fields.

13) Write syntax for Index in MongoDB?

Syntax:
db.COLLECTION_NAME.ensureIndex ( {Col_name:VALUE} )

14) Explain GridFS in MongoDB.

GridFS is used to retrieve large data files such as image, video, audio files. Default method is fs.files, fs.chunks for storage of files metadata and chunks.

15) Write alternate database of MongoDB?

  • CouchDB
  • Cassandra
  • Hbase
  • Redis
  • Riak

16) Why is MongoDB not chosen for a 32-bit system?

Mongo DB is not considered as a 32-bit system because for running the 32-bit MongoDB, with the server, information and indexes require 2 GB.

17) How does Journaling work in MongoDB?

Journaling is used to safe backups in mongodb.Write operations are saved in the memory while journaling is going on. The on-disk journal files are really dependable for the reason that the journal writes are habitual. Inside dbPath, a journal subdirectory is designed by MongoDB.

18) What is CRUD?

Mongodb provides CRUD operations that are create, Read, Update, Delete.

19) What is Aggregation in MongoDB?

Aggregations are operations that process data records and return computed results.

20) Which command is used for inserting a document?

database.collection.insert (document) is used for inserting a document.

21) What is the use of profiler?

Profiler is used to show the performance characteristics of every operation against the database.

22) What is embedded documents?

Embedded documents capture relationships between data by storing related data in a single document structure.

23) What is replica set oplog?

The oplog records all operations that modify the data in the replica set.

24) What is vertical scaling?

Vertical scaling adds more CPU and storage resources to increase capacity.

25) What is horizontal scaling?

Horizontal scaling divides the data set and distributes the data over multiple servers, or shards.

Related Topics

Top 16 Moo Tools Interview Questions for 2024

1) What is Moo Tools? MooTools stands for My Object-Oriented Tools. It is a lightweight and object-oriented JavaScript framework. It is used to create dynamic web page. It is developed by Valerio...

5 minutes read.

Top 15 SVG Interview Questions for 2024

1) What is SVG? SVG stands for Scalable Vector Graphics, It is XML based format used to draw dimentional vector images. It is a W3C standard. SVG supports all image formats. 2) What are...

2 minutes read.

Top 28 Angular 2 Interview Questions for 2024

1) What is Angular 2? It is an open source JavaScript framework which is used to build web applications in JavaScript and HTML. It is also used to overcome obstacles encountered while...

4 minutes read.

Top 50 HTML Interview Questions for 2024

1) What is HTML? HTML stands for Hyper Text Markup Language. It is used for creating web pages and web applications. HTML documents are made up of two things: the content and the tags. 2) What are...

10 minutes read.

A to Z Interview Questions

ABCDEFGHIJKLMNOPQRSTUVWXYZ Interview Questions and Answers List A AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions B Blockchain Interview...

3 minutes read.

Top 30 Magento Interview Questions for 2024

1) What is Magento? Magento is an open-source content management system. It is used to create e-commerce websites. It is developed by Varien ,Inc, a US private company headquartered in Culver City, California. It...

5 minutes read.

SSRS Interview Questions

1. What is SSRS? The Microsoft SQL Server Reporting Service (SSRS) is a server-based reporting platform. It allows you to produce structured reports. The reports are generally represented in the form of data, graph,...

5 minutes read.

Top 15 Java JDBC Interview Questions for 2024

1) What are the types of JDBC Drivers in Java? JDBC Drivers are of four types are: JDBC-ODBC bridge driver Native-API driver Network Protocol driver Thin driver 2) What are the five...

4 minutes read.

Top 15 JCL (Job Control Language) Interview Questions for 2024

1) What is JCL? JCL refers to Job Control Language. It is a command language which describes job (unit of work) for the Multiple Virtual Storage (MVS) operating system. It is...

3 minutes read.

Top 25 Oracle DBA Interview Question for 2024

1) What is an Oracle Instance? Database instance is a set of memory structures that manages database file. When an instance is started Oracle database allocate memory area called SGA (System...

4 minutes read.

Top 20 Java Programming Coding Interview Questions for 2024

Coding is an integral part of any programming language. It is the most important phase of an interview. Interviewee checks the capability of thinking of any particular. I think one...

13 minutes read.

Top 31 Dart Programming Interview Questions for 2024

1) What is Dart? Dart is an application programming language. It is used to build web, server and mobile applications. 2) Who is the developer of Dart? Google is the developer of Dart. 3)...

6 minutes read.

Top 20 HTTP Interview Questions for 2024

1) What is HTTP? HTTP stands for Hypertext Transfer Protocol. It is a set of rules for transferring of data on WWW (World Wide Web). 2) What are the basic Features of...

4 minutes read.

SSIS Interview Questions and Answers

Q.1 What is SSIS? SQL Server Integration Service (SSIS) is a component of Microsoft SQL Server. It is a powerful ETL tool that is used for building enterprise-level data transformation and...

5 minutes read.

Top 25 MongoDB interview Questions for 2024

1) Give some history about MongoDB. MongoDB came into existence when data increased exponentially on the internet. Thus, maintainence of database became very difficult in structured DB. MongoDB is a NoSQL...

3 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 30 Cassandra Interview Questions for 2024

1) Explain. What is Cassandra? Cassandra is an open source data storage system. It was developed at Facebook for inbox search and designed for storing and managing large amount of data. 2)...

5 minutes read.

Top 15 Bootstrap Interview Questions for 2024

1) Explain what is Bootstrap? It is a Framework which is used for building the web application with minimal effort. Bootstrap is also used for developing responsive, mobile-first web sites. 2) What...

10 minutes read.

Top 31 CakePHP Interview Questions for 2024

1) What is CakePHP? CakePHP is an open-source PHP framework. It is used to develop dynamic web applications. It helps to developers to work in a structured manner. 2) When cakePHP was...

5 minutes read.

Top 13 SAS Interview Questions for 2024

1. What is SAS and its functions? SAS (Statistical Analysis System) is statistical software designed by SAS Institute in 1960 for data inspection and report writing. SAS runs on Windows, UNIX...

5 minutes read.