MongoDB Interview Questions – Set 01

What will have to do if a shard is down or slow and you do a query?

If a shard is down and you even do query then your query will be returned with an error unless you set a partial query option. But if a shard is slow them Mongos will wait for them till response.

What is CRUD in MongoDB?

MongoDB supports following CRUD operations:

  • Create
  • Read
  • Update
  • Delete

What is the usage of profiler in MongoDB?

A database profiler is used to collect data about MongoDB write operations, cursors, database commands on a running mongod instance. You can enable profiling on a per-database or per-instance basis.

The database profiler writes all the data it collects to the system. profile collection, which is a capped collection.

What is the difference between MongoDB and Cassandra?

Difference between MongoDB and Cassandra:

  • MongoDB is cross-platform document-oriented database system while Cassandra is high performance distributed database system.
  • MongoDB is written in C++ while Cassandra is written in Java.
  • MongoDB is easy to administer in the case of failure while Cassandra provides high availability with no single point of failure.

What type of DBMS is MongoDB?

MongoDB is a document oriented DBMS

Why does Profiler use in MongoDB?

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

Do the MongoDB databases have schema?

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

Is there any need to create database command in MongoDB?

You don’t need to create a database manually in MongoDB because it creates automaically when you save the value into the defined collection at first time.

Explain the covered query in MongoDB.

A query is called covered query if satisfies the following two conditions:

  • The fields used in the query are part of an index used in the query.
  • The fields returned in the results are in the same index.

In which format MongoDB represents document structure?

MongoDB uses BSON to represent document structures.