Friday, 19 August 2016

MongoDB Interview Questions and Answers

 MongoDB Interview Questions and Answers

Question: What is MongoDB?
MongoDB is a cross-platform document-oriented database and classified as a NoSQL database. Its not relational database.
MongoDB works on concept of collection and document.

Question: Is it similar to SQL/MySQL?
No, Its totally different from Relational database.

Question: In which language, MongoDB is written?
C/C++, JavaScript

Question: When First MongoDB was released?

Question: When latest MongoDB was released?
13 July 2016

Question: What is latest version of MongoDB?

Question: Is it opensource?
Yes, It is free to use.

Question: What is offical website of MongoDB?

Question: Compare the Terminology of MongoDB and RDBMS?
Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key Primary Key (Default key _id provided by mongodb itself)

Question: Compare the Feature of MongoDb?
Feature MySQL MongoDB
Rich Data Model No Yes
Dyamic Schema No Yes
Typed Data Yes Yes
Data Locality No Yes
Field Updates Yes Yes
Easy for Programmers No Yes
Complex Transactions Yes No
Auditing Yes Yes
Auto-Sharding No Yes

Question: What are main feature of MongoDB?
  1. Document-oriented
  2. Ad hoc queries
  3. Indexing
  4. Replication
  5. Load balancing
  6. File storage
  7. Aggregation
  8. Server-side JavaScript execution
  9. Capped collections

Question: What is NoSQL?
It is database which provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases like SQL, Oracle, etc.

Question: What are different type of NoSQL?
  1. Key Value
  2. Column Oriented
  3. Document Oriented
  4. Graph

Question: What is Namespace in MongoDB?
A Namespace is the concatenation of the "database name" and "collection name"

Question: Does  MongoDB provide drivers for PHP?
MongoDB provide the drivers for C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go and Erlang.

Question: What difference between MongoDB and SQL?
MongoDB allows a highly flexible and scalable document structure.
For e.g. one data document in MongoDB can have five columns &  other one in the same collection can have ten columns. Also, MongoDB database are faster as compared to SQL databases due to efficient indexing and storage techniques.

Question: Does MongoDB support foreign key relationships in MongoDB?
No,Its does not support
But we achieve this concept by embedding one document inside another.

Does MongoDB need lot of RAM?
No, It need less than as compare to other database like SQL,MySQL.
MongoDB dynamically allocates and de-allocates RAM based on the requirements of other processes.

Question: What is the structure of ObjectID in MongoDB?
ObjectID is a 12-byte BSON type with:
4 bytes value representing seconds
3 byte machine identifier
2 byte process id
3 byte counter

Question: How many indexes does MongoDB create by default for a new collection?
By default, MongoDB created the _id collection for every collection.

Question: Explain what are indexes in MongoDB?
Indexes are special structures in MongoDB, which stores a small portion of the data set in an easy to traverse form.

Question: What is sharding in MongoDB?
The procedure of storing data records across multiple machines is referred as Sharding.

Question: How can you see the connection used by Mongos?
To see the connection used by Mongos use db_adminCommand ('connPoolStats');

Question: Explain what is a replica set?
A replica set is a group of mongo instances that host the same data set.

Question: Mention what is the command syntax for inserting a document?
database.collection.insert (document).

Question: Explain what is GridFS in MongoDB?
For storing and retrieving large files such as images, video and audio GridFS is used.

Question: What are alternatives to MongoDB?
Cassandra, CouchDB, Redis, Riak, HBase

No comments:

Post a Comment