Basic Mongodb Interview Questions
Basic Mongodb Interview Questions
Basic Mongodb Interview Questions
MongoDB has become one of the must skill set for MEAN stack and backend developers. MongoDB has proven
to be the most suited database for the modern applications. Also MongoDB fits well for the Agile methodology.
This tutorial presents you with almost all possible MongoDB Interview Questions for basic, intermediate and
advanced levels.
What is MongoDB ?
MongoDB is a document based NoSQL Database.
What are the equivalents of Tables and Rows in SQL to that of MongoDB ?
MongoDB Collections could be considered as equivalent to Tables and MongoDB Documents could be
considered as equivalent to Row of SQL.
What are the data types that are allowed for values in key:value pairs of
documents.
MongoDB Document follows BSON (Binary JSON) Specification. And the data types allowed are all those that
are specified in BSON specification.
What should be done when you have to work with large datasets and high data
throughput ?
MongoDB is horizontally scalable. If the application is expected to handle large datasets and high data
throughput, you may add required number of computers (/nodes) to the cluster.
MongoDB can handle structured data(like a spread-sheet or table), semi structured data and unstructured data (data with
no rules, examples are multimedia content).
All the NoSQL features of MongoDB makes it a perfect fit for Agile methodology during application development. Modern
applications are designed to have fewer development time and quick updates to the ever ending requirements.
MongoDB is horizontally scalable. Hence it can respond to the increasing application requirements with less hardware cost.
What are the requirements that ring a bell to use MongoDB for an application ?
Try to answer the following questions, and if you get an YES for most of them, choose MongoDB.
~$ sudo service
mongod start
Once Mongo Daemon is up and running, we can start a Mongo Shell using mongo command in terminal.
~$ mongo
~$ mongo
~$ <span class="c-
v">mongo </span>
<span class="c-o">--
</span><span
class="c-
~$ <span class="c-v">mongo </span><span class="c-o">--</span><span class="c-v">port</span> <span class="c-
v">port</span> <span
o"><</span><span class="c-v">port_number</span><span class="c-o">></span>
class="c-o"><</span>
<span class="c-
v">port_number</span
><span class="c-o">>
</span>
What is a MongoDB Database ?
In MongoDB, Database is a collection of MongoDB Collections.
How do you start working on a specific MongoDB Database through mongo shell
?
use <database_name> command in mongo shell can be used to connect to a specific MongoDB Database.
db.
<collection_name>.dro
p()
db.<collection_name>.drop()
Upon successful deletion, the command echoes back true to the prompt.
What happens when you try delete a Collection that does not exist ?
db.<collection_name>.drop() command returns false .
{
name: "Robin",
age: 23,
place: "New York",
{ hobbies: ["Singing",
"Reading Books"]
} name: "Robin",
age: 23,
place: "New York",
hobbies: ["Singing", "Reading Books"]
}
MongoDB Tutorial
⊩ MongoDB Tutorial
⊩ MongoDB Shell
⊩ MongoDB Script
Database
⊩ MongoDB Database
Collections
⊩ MongoDB Collection
Documents
⊩ MongoDB Document
⊩ MongoDB Locks
⊩ MongoDB Locks
MongoDB Concepts
⊩ MongoDB MapReduce
MongoDB Queries
⊩ MongoDB Date
MongoDB Queries
⊩ MongoDB Date()
MongoDB Integration
MongoDB Java
MongoDB Python
MongoDB Kotlin
MongoDB Node.js
⊩ Node.js MongoDB
MongoDB Others
Useful Resources