MongoDB interview questions

MongoDB quiz questions

  • 1.

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

    Answer:

    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.

    View
  • 2.

    Is it possible to remove old files in the moveChunk directory?

    Answer:

    Yes, These files can be deleted once the operations are done because these files are made as backups during normal shard balancing operation. This is a manual cleanup process and necessary to free up space.

    View
  • 3.

    Why 32 bit version of MongoDB are not preferred ?

    Answer:

    Because MongoDB uses memory mapped files so when you run a 32-bit build of MongoDB, the total storage size of server is 2 GB. But when you run a 64-bit build of MongoDB, this provides virtually unlimited storage size. So 64-bit is preferred over 32-bit.

    View
  • 4.

    How to do Transaction/locking in MongoDB?

    Answer:

    MongoDB doesn't use traditional locking or complex transaction with Rollback. MongoDB is designed to be light weighted, fast and predictable to its performance. It keeps transaction support simple to enhance performance.

    View
  • 5.

    What is the method to configure the cache size in MongoDB?

    Answer:

    MongoDB's cache is not configurable. Actually MongoDb uses all the free spaces on the system automatically by way of memory mapped files.

    View
  • 6.

    Do the MongoDB databases have schema?

    Answer:

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

    View
  • 7.

    Does MongoDB database have tables for storing records?

    Answer:

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

    View
  • 8.

    What language you can use with MongoDB?

    Answer:

    MongoDB client drivers supports all the popular programming languages so there is no issue of language, you can use any language that you want.

    View
  • 9.

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

    Answer:

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

    View
  • 10.

    In which language MongoDB is written?

    Answer:

    MongoDB is written and implemented in C++.

    View
  • 11.

    If you remove an object attribute, is it deleted from the database?

    Answer:

    Yes, it be. Remove the attribute and then re-save() the object.

    View
  • 12.

    Why does Profiler use in MongoDB?

    Answer:

    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

    View
  • 13.

    Can journaling features be used to perform safe hot backups?

    Answer:

    Yes.

    View
  • 14.

    What is a Namespace in MongoDB?

    Answer:

    Namespace is a concatenation of the database name and the collection name. Collection, in which MongoDB stores BSON objects.

    View
  • 15.

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

    Answer:

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

    View
  • 16.

    What are Indexes in MongoDB?

    Answer:

    In MondoDB, Indexes are used to execute query efficiently. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect.

    View
  • 17.

    Is it true that MongoDB uses BSON to represent document structure?

    Answer:

    Yes.

    View
  • 18.

    Explain the structure of ObjectID in MongoDB.

    Answer:

    ObjectID is a 12-byte BSON type. These are:

    • 4 bytes value representing seconds
    • 3 byte machine identifier
    • 2 byte process id
    • 3 byte counter
    View
  • 19.

    Does MongoDB need a lot of RAM?

    Answer:

    No. There is no need a lot of RAM to run MongoDB. It can be run even on a small amount of RAM because it dynamically allocates and de-allocates RAM according to the requirement of the processes.

    View
  • 20.

    Can you achieve primary key - foreign key relationships in MongoDB?

    Answer:

    We can achieve primary key-foreign key relationship by embedding one document inside another. For example: An address document can be embedded inside customer document.

    View

© 2017 QuizBucket.org