Mongodb Interview Questions 2019

by Bhavya Sri, on May 19, 2017 4:57:38 PM

Mongodb Interview Questions 2019

Q1. Compare MongoDB and Cassandra



  • Data Model
  • Database scalability
  • Querying of data
  • Document
  • Read
  • Multi-indexed
  • Big Table like
  • Write
  • Using Key or ScanMongoDB is considered to be best NoSQL database because of :Document-oriented (DO)
    High performance (HP)
    High availability (HA)
    Easy scalability
    Rich query language

Q2. What makes MongoDB the best?

Ans: MongoDB is considered to be best NoSQL database because of :Document-oriented (DO)

  • High performance (HP)
  • High availability (HA)
  • Easy scalability
  • Rich query language

Q3. How to do transactions/locking in MongoDB?

Ans: MongoDB does not use conventional locking with reduction, as it is planned to be light, high-speed and knowable in its presentation. It can be considered as parallel to the MySQL MyISAM auto entrust sculpt. With simplest business sustain, performance is enhanced, particularly in a structure with numerous servers.

Q4. When and to what extent does Data get extended to Multi-slice?

Ans: The MongoDB scrap stands on a collection. So an album of all substances is kept in a lump or mass. Only when there is an additional time slot, there will be more than a few slice data achievement choices, but when there is more than 1 lump, data gets extended to a lot of slices and it can be extended to 64 MB.

Q5. Judge against MongoDB with Couchbase and CouchbaseDB?

Ans: Although Mongo DB with Couchbase and Couchbase DB are common in many ways, but still they are different in the case of necessities for execution of the model, crossing points, storage, duplications, etc.

Q6. When do we use Namespace in MongoDB?

Ans: During sequencing of the names of the database and collection name Namespace is used.

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

Ans: Yes, it is deleted. So better eliminate the attribute and then save the object again.

Q8. How can we move the old file in the moveChunk directory?

Ans: Once the functions are done, the old files are converted to backup files and moved to the moveChunk directory at the time of balancing the slices.

Q9. Explain the situation when an index does not fit into RAM?

Ans: When an index is too huge to fit into RAM, then MongoDB reads the index, which is faster than reading RAM because the indexes easily fit into RAM if the server has got RAM for indexes along with the remaining set.

Q10. How does MongoDB provide consistency?

Ans: MongoDB uses the reader-writer locks, allowing simultaneous readers to access any supply like a database or any collection. But always offers private access to singles writes.

Q11. Why is MongoDB not chosen for a 32-bit system?

Ans: Mongo DB is not considered as a 32-bit system because for running the 32-bit MongoDB, with the server, information and indexes require 2 GB. So only it is not used in 32-bit devices.

Q12. How does Journaling work in MongoDB?

Ans: Write operations are saved in the memory while journaling is going on. The on-disk journal files are really dependable for the reason that the journal writes are habitual. Inside dbPath, a journal subdirectory is designed by MongoDB.

Q13. How can you isolate our cursors from intervening with the write operations?

Ans: Snapshot () method is used to isolate cursors from intervening with writes. This method negotiates the index and makes sure that each query comes to any article only once.

Q14. Define MongoDB.

Ans: It is document oriented database which is used to high availability, easy scalability and high performance. It supports the dynamic schema design.

Q15. Explain replica set.

Ans: It is a group of mongo instances that maintain same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.

Q16. What are the key features of mongodb?

Ans: There are 3 main features of mongodb that are automatic scaling, High performance and high availability.

Q17. What is CRUD?

Ans: Mongodb provides CRUD operations that are create, Read, Update, Delete.

Q18. What is sharding?

Ans: Sharding means to store the data on the multiple machines.

Q19. What is Aggregation in MongoDB?

Ans: Aggregations are operations that process data records and return computed results.

Q20. Define the namespace in mongodb?

Ans: It is the concatenation of collection name and database.

Q21. Which syntax is used to create collection in mongodb?

Ans: db.createCollection(name,options) is used to create collection in mongodb.

Q22. Which syntax is used to drop collection in mongodb?

Ans: db.collection.drop() is used to drop collection in mongodb.

Q23. Explain Replication.

Ans: Replication is the process of synchronizing data across multiple servers.

Q24. What is the use of Index in mongodb?

Ans: Indexes provide high performance read operations for frequently used queries.

Q25. Which command is used for inserting a document?

Ans: database.collection.insert (document) is used for inserting a document.

Q26. What is use of GridFS in mongodb?

Ans: GridFS is used for storing and retrieving the large files like audio, Images, Video files.

Q27. What is the use journaling?

Ans: Journaling is used to safe backups in mongodb.

Q28. Which command is used to see the connection?

Ans: db_adminCommand (“connPoolStats”); is used to see the connection.

Q29. Define primary replica sets?

Ans: The primary replica set accepts all write operations from clients.

Q30. Define secondary replica sets.

Ans: The secondaries (page 565) replicate the primary’s oplog and apply the operations to their data sets such that the secondaries’ data sets reflect the primary’s data set.

Q31. What is the use of profiler?

Ans: Profiler is used to show the performance characteristics of every operation against the database.

Q32. Which type of data mongodb store?

Ans: MongoDB stores data in the form of documents, which are JSON-like field and value pairs.

Q33. What is purpose of replication?

Ans: Replication provides redundancy and increases data availability.

Q34. what is embedded documents?

Ans: Embedded documents capture relationships between data by storing related data in a single document structure.

Q35. Define application level encryption.

Ans: Application Level Encryption provides encryption on a per-field or per-document basis within the application layer.

Q36. What is storage encryption?

Ans: Storage Encryption encrypts all MongoDB data on the storage or operating system to ensure that only authorized processes can access protected data.

Q37. Which method is used to create an index?

Ans: CreateIndex() method is used to create an index.

Q38. What is replica set oplog?

Ans: The oplog records all operations that modify the data in the replica set.

Q39. What is vertical scaling?

Ans: Vertical scaling adds more CPU and storage resources to increase capacity.

Q40. Define horizontal scaling.

Ans: It divides the data set and distributes the data over multiple servers, or shards.

Q41. What are the components of shared cluster?

Ans: Sharded cluster has the following components: shards, query routers and config servers.

Q42. Which command is use to create database?

Ans: DATABASE_NAME command is used to create database.

Q43. Which command is use to drop database?

Ans: db.dropDatabse() command is used to drop the database.

Q44. What is the use of pretty() method?

Ans: Pretty() method is used to show the results in a formatted way.

Q45. Which method is used to remove the document form the collection?

Ans: Remove() method is used to remove the document form the collection.

Q46. Define Mongodb projection.

Ans: Projection is used to select only necessary data.It did not select whole data of a document.

Q47. What is the use of limit() method?

Ans: Limit() method is used to limit the records in database.

Q48. What is the syntax of limit() method?

Ans: db.COLLECTION_NAME.find().limit(NUMBER) syntax is used.

Q49. What is the syntax of sort() method?

Ans: db.COLLECTION_NAME.find().sort({KEY:1}) syntax is used for sorting the documents.

Q50. Which command is used to create the backup of database?

Ans: Mongodump command is used to create the backup of database.

Topics:mongo db interview questionsExcel VBA interview questions 2019interview questions for maongodbInformation Technologies (IT)



Top Courses in Python

Top Courses in Python

We help you to choose the right Python career Path at myTectra. Here are the top courses in Python one can select. Learn More →

aathirai cut mango pickle