For BE/B.Tech/BCA/MCA/ME/M.Tech Major/Minor Project for CS/IT branch at minimum price Text Message @ 9424820157

MongoDB Interview Questions

                      Top MongoDB Interview Questions & Answers


1) What is the use of the capped collection in MongoDB?
Capped collections are fixed-size collections that restrict updates to the documents if the update results in increased document size and it ensures that the document size does not increase the size allocated on the disk.
  
2) What are Primary and Secondary Replica sets?
A replica set is a group of MongoDB instances that host the same data set. The primary is the only member in the replica set that receives write operations. Whereas Secondary members replicate this log and apply the operations to their data sets.

3) What is splitting in mongodb?
In MongoDb, Splitting is a process that keeps chunks from growing too large with the help of split command(). MongoDB splits the chunk, when a chunk grows beyond a specified chunk size, on the basis of shard key values the chunk represents.

4) What do you know about MongoDB?
MongoDB is a cross-platform document-oriented database program that is open source and free in nature. It can also be classified as the NoSQL database program. It was developed by MongoDB Inc. JSON-like documents with schema are used by MongoDB. Field, range queries, and regular expressions are also supported by MongoDB. The queries used by this contain user-defined JavaScript functions. It provides high availability with the replica sets. Fields can be indexed with primary and secondary indices. Sharding is used by MongoDB for scaling horizontally which determines how the data will be distributed. It can also be used as a file system with load balancing. It can also be used for batch processing of data.

5) Explain what is MongoDB?
MongoDB is an open-source NoSQL database management program that supports various forms of data. MongoDB is basically used as a tool that can manage document-oriented information, store or retrieve information.

6) List some important features of MongoDB?
Some of the important features of MongoDB are as follows:
Support ad hoc queries. 
Indexing and Replication.
Duplication of data. 
Load balancing. 
Supports map reduction and aggregation tools.
Uses JavaScript instead of Procedures.
It is a schema-less database written in C++.

7) What is namespace in MongoDB?
A namespace is a canonical name for a collection or index in MongoDB. The namespace is basically a combination of the database name and the name of the collection or index, like so: [database-name]. [collection-or-index-name] .

8) What is BSON in MongoDB?
BSON stands for Binary JSON which is a binary serialization of JSON-like documents that is used by MongoDB to store the documents in a BSON format. BSON implementation is used for supporting embedding objects and arrays within other objects.

9) What type of DBMS is MongoDB?
MongoDB is an open-source NoSQL type DBMS or database management program that supports various forms of data.

10) What is the document structure of MongoDB?
MongoDB uses JSON format as the structure of the document. JSON documents support embedded fields, so related data and lists of data can be stored with the document instead of an external table.

11) What is replica set in MongoDB?
In MongoDB, a Replica Set is used to carry out MongoDB replication, which is a process of creating a copy of the same data set in more than one MongoDB server. A replica set is basically a group of MongoDB instances that maintain the same data set and pertain to any MongoDB process.

12) What is profiler in MongoDB?
In MongoDB, the database profiler collects detailed information about Database Commands executed against a running MongoDB instance. It writes all the data it collects to a system and captures and records data on the performance of write operations, cursors, and database commands on a running MongoDB instance.

13) Write the syntax for creating and droping a collection in MongoDB?
The syntax for creating and droping a collection in MongoDB are as follows:
Creating a Collection: collection_name. insert({key:value, key:value…})
Droping a Collection: db.collection.drop( { writeConcern: } )

14) What is the size limit of a document?
The maximum Document Size Limit in MongoDb is 16 megabytes or 16777216 bytes. The maximum document size helps ensure that a single document cannot use an excessive amount of RAM or, during transmission, an excessive amount of bandwidth.

15) What is _id Field in MongoDB?
In MongoDB, _id field is always the first field in the documents therefore each document stored in a collection requires a unique _id field that acts as a primary key.

16) Explain what is ObjectId in MongoDB?
An ObjectId in MongoDB is a 12-byte BSON type in which the first 4 bytes of the ObjectId represent the time in seconds then the next 3 bytes of the ObjectId represent the machine identifier then again the next 2 bytes are of process id and the last Field is 3 bytes used for increment the objectid.

17) Write syntax to create or select a database in MongoDB?
MongoDB uses DATABASE_NAME is used to create a database. The syntax of use DATABASE statement is as follows: use DATABASE_NAME

18) What is a collection in MongoDB?
In MongoDB, a collection is a grouping of documents such that documents within a collection can have different fields. A collection is the equivalent of a table in a relational database system and exists within a single database.

19) What is the use of insertOne and insertMany in MongoDB?
In MongoDB, insertOne() is a method that is used whenever you want to insert a single document into your collection. It is basically used to insert a single document or record into the database. Whereas The insertMany() method inserts one or more documents in the collection. It takes an array of documents to insert into the collection.

20) What is sharding in MongoDB?
In MongoDB, Sharding is the process of distributing data across multiple hosts that is achieved by splitting large data sets into small data sets across multiple MongoDB instances. Basically, Sharding is used to store data across multiple machines.

21) What is writeConcern in MongoDB?
In MongoDB, write concern describes the level of acknowledgment requested from MongoDB for write operations to a standalone MongoDB or to replica sets or to sharded clusters, such that in sharded clusters, mongoose instances will pass the write concern on to the shards.

22) What is the use of upsert in MongoDB?
MongoDB supports a feature known as upsert that mixes the functionality of an update with an insert. Upsert is an option that is used for update operation e.g. update(), findAndModify(), etc.

23) Explain what is Mongoose?
Mongoose is an Object Data Modeling or ODM library for MongoDB and Node. js. that manages relationships between data, provides schema validation and is used to translate between objects in code and the representation of those objects in MongoDB.

24) List some alternatives of MongoDB?
Some of the alternatives of MongoDB are:
JAM Stack - Fast, secure, and dynamic websites served without web servers.
PostgreSQL - SQL database is known for its reliability, features, and performance.
DynamoDB - NoSQL database created by Amazon Web Services (AWS)

25) What are 32-bit nuances?
In computer 32-bit nuances refer to the following:
There is extra memory-mapped file activity with journaling.
This will further constrain the limited DB size of 32 bit builds.
Thus, for now, journaling by default is disabled on 32 bit systems.


No comments:

Post a Comment



Please go through below tutorials:


Mule 4 Tutorials

DEPLOY TO CLOUDHUB C4E CLIENT ID ENFORCEMENT CUSTOM POLICY RABBIT MQ INTEGRATION
XML TO JSON WEBSERVICE CONSUMER VM CONNECTOR VALIDATION UNTIL SUCCESSFUL
SUB FLOW SET & REMOVE VARIABLE TRANSACTION ID SCATTER GATHER ROUND ROBIN
CONSUME REST WEBSERVICE CRUD OPERATIONS PARSE TEMPLATE OBJECT TO JSON LOAD STATIC RESOURCE
JSON TO XML INVOKE IDEMPOTENT FILTER FOR EACH FLAT TO JSON
FIXWIDTH TO JSON FIRST SUCCESSFUL FILE OPERATIONS EXECUTE ERROR HANDLING
EMAIL FUNCTIONALITY DYNAMIC EVALUATE CUSTOM BUSINESS EVENT CSV TO JSON COPYBOOK TO JSON
CHOICE ASYNC

Widely used Connectors in Mule 3

CMIS JETTY VM CONNECTOR SALESFORCE POP3
JMS TCP/IP WEBSERVICE CONSUMER QUARTZ MONGO DB
FILE CONNECTOR DATABASE CONNECTOR


Widely used Scopes in Mule 3

SUB FLOW REQUEST REPLY PROCESSOR CHAIN FOR EACH CACHE
ASYNC TCP/IP COMPOSITE SOURCE POLL UNTIL SUCCESSFUL
TRANSACTIONAL FLOW

Widely used Components in Mule 3

EXPRESSION CXF SCRIPT RUBY PYTHON
JAVASCRIPT JAVA INVOKE CUSTOM BUSINESS EVENT GROOVY
ECHO LOGGER


Widely used Transformers in Mule 3

MONGO DB XSLT TRANSFORMER REFERENCE SCRIPT RUBY
PYTHON MESSAGE PROPERTIES JAVA TRANSFORMER GZIP COMPRESS/UNCOMPRESS GROOVY
EXPRESSION DOM TO XML STRING VALIDATION COMBINE COLLECTIONS BYTE ARRAY TO STRING
ATTACHMENT TRANSFORMER FILE TO STRING XML TO DOM APPEND STRING JAVASCRIPT
JSON TO JAVA COPYBOOK TO JSON MAP TO JSON JSON TO XML FLATFILE TO JSON
FIXWIDTH TO JSON CSV TO JSON


Widely used Filters in Mule 3

WILDCARD SCHEMA VALIDATION REGEX PAYLOAD OR
NOT MESSAGE PROPERTY MESSAGE IDEMPOTENT FILTER REFERNCE
EXPRESSION EXCEPTION CUSTOM AND


Exception Strategy in Mule 3

REFERENCE EXCEPTION STRATEGY CUSTOM EXCEPTION STRATEGY CHOICE EXCEPTION STRATEGY CATCH EXCEPTION STRATEGY GLOBAL EXCEPTION STRATEGY


Flow Control in Mule 3

CHOICE COLLECTION AGGREGATOR COLLECTION SPLITTER CUSTOM AGGREGATOR FIRST SUCCESSFUL
MESSAGE CHUNK AGGREGATOR MESSAGE CHUNK SPLITTER RESEQUENCER ROUND ROBIN SOAP ROUTER