MongoDB interview questions & answers

    0 Votes

17) List out the Languages supported in MongoDB?

Below is the list of languages supported in MongoDB –
  • C
  • C++
  • C#
  • Java
  • Node.JS
  • Perl
  • Php etc.


18) How to create a new database in MongoDB?
New database can be created using the command – “use database Name”, This command will create a new database if there is no existing database or else it will return the existing database.
19) What is the command used to check the list of databases in MongoDB?

To check the list of databases we need to use the command called – “show dbs”.

20) What is the meaning of Sharding in MongoDB?

Sharding is the process of keeping the data records in multiple machines. It is an approach supported in MongoDB for data growth. It is like a horizontal partition and each partition is called Shard.

21) How to see the connection used by MongoDB?

To see the connection used by MongoDB, use – “db_adminCommand (“connPoolStats”);”.

22) What is Replication?

Replication is the process of synchronizing data across multiple servers. This will increase the data availability as multiple of copies of data will be stored across multiple servers.

23) What is replica set in MongoDB?

Replica set is the set of MongoDB instances carrying the same data set. In replica set, one is the primary node, and another is secondary. Data replication is done from primary to secondary node.

24) How to insert a document in the collection in MongoDB?

Below is the command to be used for inserting a document in MongoDB –

Db.CollectionName.Insert({“key”: “value” })

25) How to drop a database in MongoDB?

For dropping a database in MongoDB, use the following command –

Db.dropDatabase() – This will delete the selected database.

26) How to create a collection in MongoDB?

To create a collection of Customers in MongoDB, run the below command –


27) How we can check the Collections created in MongoDB?

Use the below command to check the Collections exists in the database –

Show collections

28) How we can drop a Collection in MongoDB?

Collection can be dropped using below command –


29) Why to use Profiler in MongoDB?

MongoDB Profiler is used to check the performance characteristics of operations done against the database.

30) Does MongoDB support Primary Key, Foreign Key relationships?

No. By default, MongoDB does not support Primary Key, Foreign Key relationships.

31) What are the different data types supported in MongoDB?

Below is the list of Data types supported in MongoDB –

  • String
  • Integer
  • Double
  • Boolean
  • Object
  • Object ID
  • Arrays
  • Min/Max Keys
  • Datetime
  • Code
  • Regular Expression etc.

32) Why to use “Code” datatype in MongoDB?

“Code” datatype is used to store the Java script code in a document.

33) Why to use “Regular Expression” datatype in MongoDB?

“Regular Expression” datatype is used to store regular expression in a document.

Page 2 of 3

Popular Videos


How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

SQL Queries Interview Questions and Answers
Database & SQL Interview Questions
Oracle Interview Questions and Answers on SQL Queries and Database Theory
Advanced SQL Interview Questions and Answers
SQL Server Interview Questions and Answers