MongoDB Interview Questions 2017

by Bharathkumar, on Sep 10, 2022 10:31:17 PM

Interview Questions (58)

1.Compare MongoDB and Cassandra

Criteria MongoDB Cassandra
Data Model Document Big Table like
Database scalability Read Write
Querying of data Multi-indexed 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
 
2. What makes MongoDB the best?

MongoDB is considered to be best NoSQL database because of :Document-oriented (DO)
High performance (HP)
High availability (HA)
Easy scalability
Rich query language

3. How to do transactions/locking in MongoDB?

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.

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

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.

5. Judge against MongoDB with Couchbase and CouchbaseDB?

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.

6. When do we use Namespace in MongoDB?

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

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

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

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

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.

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

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.

10. How does MongoDB provide consistency?

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.

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

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.

12. How does Journaling work in MongoDB?

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.

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

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.

14. Define MongoDB.

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

15. Explain replica set.

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.

16. What are the key features of mongodb?

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

17. What is CRUD?

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

18. What is sharding?

Sharding means to store the data on the multiple machines.

19. What is Aggregation in MongoDB?

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

20. Define the namespace in mongodb?

It is the concatenation of collection name and database.

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

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

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

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

23. Explain Replication.

Replication is the process of synchronizing data across multiple servers.

24. What is the use of Index in mongodb?

Indexes provide high performance read operations for frequently used queries.

25. Which command is used for inserting a document?

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

26. What is use of GridFS in mongodb?

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

27. What is the use journaling?

Journaling is used to safe backups in mongodb.

28. Which command is used to see the connection?

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

29. Define primary replica sets?

The primary replica set accepts all write operations from clients.

30. Define secondary replica sets.

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.

]31. What is the use of profiler?

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

32. Which type of data mongodb store?

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

33.What is purpose of replication?

Replication provides redundancy and increases data availability.

34. what is embedded documents?

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

35. Define application level encryption.

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

36. What is storage encryption?

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

37. Which method is used to create an index?

CreateIndex() method is used to create an index.

38. What is replica set oplog?

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

39. What is vertical scaling?

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

40. Define horizontal scaling.

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

41. What are the components of shared cluster?

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

42. Which command is use to create database?

DATABASE_NAME command is used to create database.

43. Which command is use to drop database?

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

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

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

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

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

46. Define Mongodb projection.

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

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

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

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

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

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

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

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

Mongodump command is used to create the backup of database.

Topics:Interview Questions with Answers

Comments

Subscribe