MONGODB INTERVIEW QUESTION ANSWER

MongoDB Img

1) What is MongoDB?

MongoDB is a document-oriented NoSQL database used for high-volume data storage. Instead of using tables and rows as in the traditional relational databases, MongoDB makes use of collections and documents. Documents consist of key-value pairs which are the basic unit of data in MongoDB.

2) Why is MongoDB used?

Using MongoDB can provide many benefits to a software development team. Its flexible schema makes it easy to evolve and store data in a way that is easy for programmers to work with. MongoDB is also built to scale up quickly and supports all the main features of modern databases such as transactions.

3) When MongoDB is used?

The motivation of the MongoDB language is to implement a data store that provides high performance, high availability, and automatic scaling.
MongoDB is extremely simple to install and implement. MongoDB uses JSON or BSON documents to store data. General distributions for MongoDB support Windows, Linux, Mac OS X, and Solaris.

4) What are the features of MongoDB?

Following are the important features of MongoDB:

  • A compliant data model in the format of documents.
  • Agile and extremely scalable database.
  • Quicker than traditional databases.
  • Demonstrative query language. 

5) Explain Namespace?

A namespace is the series of the collection name and database name.

6) Differentiate MongoDB and MySQL?

Despite MySQL and MongoDB being freeware and open source databases, there are several differences between them in terms of a data relationship, transaction, performance speed, querying data, schema design, normalization, etc. Comparison between MongoDB and MySQL is similar to the comparison between Non-relational and Relational databases.

7) Why MongoDB is the best NoSQL database?

MongoDB is the best NoSQL database due to the following features:

  • High Performance
  • High Availability
  • Easily Scalable
  • Rich Query Language
  • Document Oriented


8) What is a Document in MongoDB?

  • A Document in MongoDB is an ordered set of keys with associated values. It is represented by a map, hash, or dictionary. In JavaScript, documents are represented as objects:
     {"greeting" : "Hello world!"}
  • Complex documents will contain multiple key/value pairs:
     {"greeting" : "Hello world!", "views" : 3}


9) What is a Collection in MongoDB?

A collection in MongoDB is a group of documents. If a document is the MongoDB analog of a row in a relational database, then a collection can be thought of as the analog to a table.

10) What is a replica set?

We can specify the replica as a set of the mongo instances which host a similar data set. In the replica set, one node will be primary, and another one will be secondary. We replicate all the data from the primary to the secondary nodes.

12) Which languages can we use with MongoDB?

At Present, MongoDB offers driver support to c++, java, PHP, Perl, Python, Go, Scala, Ruby.

13) Define Collection?

The collection is a set of MongoDB documents.

14) Explain Aggregation Pipeline?

The aggregation Pipeline acts as a framework to perform aggregation tasks. We use this pipeline for transforming the documents into aggregated results.

15) Explain MapReduce?

MapReduce is a standard multi-phase data aggregation modality which we use to process the data quantities.

16) Explain Splitting?

Splitting is the background process that we use to store chunks from increasing too large.

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

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

18) 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.

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

Yes.

20) Why does Profiler use in MongoDB?

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

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

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

23) 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.

24) Does the MongoDB database have tables for storing records?

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

25) Do the MongoDB databases have a schema?

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

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

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

27) What is CRUD in MongoDB?

MongoDB supports the following CRUD operations:

  • Create
  • Read
  • Update
  • Delete


28) In which format MongoDB represents document structure?

MongoDB uses BSON to represent document structures.

29) Which command do we use for creating the backup of the database?

We use the mongodump command for creating the database backup.

30) Which command do we use for restoring the backup?

We use mongorestore for restoring the backup.

31) Explain the importance of the dot notation?

In MongoDB, we use dot notation for accessing the array elements and the fields of an embedded document.

32) Explain Sharding and Aggregation in MongoDB?

  • Aggregation: Aggregations are the activities that handle the data records and give the record results.
  • Sharding: Sharding means storing the data on multiple machines.

Post a Comment

0 Comments