Mongodb Interview Questions & Answers part 1
Q: – What makes Mongodb best?
Rich query language
Q: – If I am using replication, can some members use journaling and others not?
Q: – Can I use the journaling feature to perform safe hot backups?
Q: – What is 32 bit nuances?
There is extra memory mapped file activity with journaling. This will further constrain the limited db size of 32 bit builds. Thus, for now journaling by default is disabled on 32 bit systems.
Q: – Will the journal replay have problems if entries are incomplete (like the failure happened in the middle of one)?
Each journal (group) write is consistent and won't be replayed during recovery unless it is complete.
Q: – What is role of Profiler in MongoDB?
MongoDB includes a database profiler which shows performance characteristics of each operation against the database. Using the profiler you can find queries (and write operations) which are slower than they should be; use this information, for example, to determine when an index is needed.
Q: – What's a "namespace"?
MongoDB stores BSON objects in collections. The concatenation of the database name and the collection name (with a period in between) is called a namespace.
Q: – If you remove an object attribute is it deleted from the store?
Yes, you remove the attribute and then re-save() the object.
Q: – Does an update fsync to disk immediately?
No, writes to disk are lazy by default. A write may hit disk a couple of seconds later. For example, if the database receives a thousand increments to an object within one second, it will only be flushed to disk once. (Note fsync options are available though both at the command line and via getLastError_old.)
Q: – How do I do transactions/locking?
MongoDB does not use traditional locking or complex transactions with rollback, as it is designed to be lightweight and fast and predictable in its performance. It can be thought of as analogous to the MySQL MyISAM autocommit model. By keeping transaction support extremely simple, performance is enhanced, especially in a system that may run across many servers.
Q: – Why are my data files so large?
MongoDB does aggressive preallocation of reserved space to avoid file system fragmentation.
Submitted By:-Kunal Email-ID: – firstname.lastname@example.org