Question 1. What Is The Basic Difference Between Mysql And Mongodb?
Answer :
MySQL and MongoDB are both free and open source databases.
MySQL and MongoDB have a lot of basic differences in terms of data representation, querying, relationships, transactions, schema design and definition, normalization, speed and performance.
By comparing MySQL with MongoDB, we are comparing Relational and non-relational databases.
Question 2. How Do You Compare Mongodb With Couchdb And Couchbase?
Answer :
- MongoDB and CouchDB are both document-oriented databases. MongoDB and CouchDB are the best examples of open source NoSQL database.
- Aside from both storing documents though, it turns out that they don’t share much in common.
- There are a lot of difference between MongoDB and CouchDB in terms of implementation of their data-model, interface, object storage, replication methods etc.
Question 3. What Makes Mongodb Best?
Answer :
Following features of MongoDB make it best NoSQL database:
- Document-oriented
- High performance
- High availability
- Eazy scalability
- Rich query language
Question 4. What Is 32 Bit Nuances?
Answer :
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.
Question 5. Will The Journal Replay Have Problems If Entries Are Incomplete (like The Failure Happened In The Middle Of One)?
Answer :
Each journal (group) write is consistent and won’t be replayed during recovery unless it is complete.
Question 6. What Is Role Of Profiler In Mongodb?
Answer :
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.
Question 7. If You Remove An Object Attribute Is It Deleted From The Store?
Answer :
Yes, you remove the attribute and then re-save() the object.
Question 8. Can I Use The Journaling Feature To Perform Safe Hot Backups?
Answer :
Yes
Question 9. Are Null Values Allowed?
Answer :
For members of an object, yes. You cannot add null to a database collection though as null is not an object. You can add {}, though.
Question 10. Does An Update Fsync To Disk Immediately?
Answer :
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 rsync options are available though both at the command line and via getLastError old.)
Question 11. How Do I Do Transactions/locking?
Answer :
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.
Question 12. Why Are My Data Files So Large?
Answer :
MongoDB does aggressive preallocation of reserved space to avoid file system fragmentation.
Question 13. How Long Does Replica Set Failover Take?
Answer :
It may take 10-30 seconds for the primary to be declared down by the other members and a new primary elected.
During this window of time, the cluster is down for “primary” operations – that is, writes and strong consistent reads. However, you may execute eventually consistent queries to secondaries at any time (in slaveOk mode), including during this window.
Question 14. What’s A Master Or Primary?
Answer :
This is a node/member which is currently the primary and processes all writes for the replica set. In a replica set, on a failover event, a different member can become primary.
Question 15. What’s A Secondary Or Slave?
Answer :
A secondary is a node/member which applies operations from the current primary. This is done by tailing the replication oplog (local.oplog.rs).
Replication from primary to secondary is asynchronous, however the secondary will try to stay as close to current as possible (often this is just a few milliseconds on a LAN).
Question 16. Should I Start Out With Sharded Or With A Non-sharded Mongodb Environment?
Answer :
We suggest starting unsharded for simplicity and quick startup unless your initial data set will not fit on single servers.
Upgrading to sharding from unsharded is easy and seamless, so there is not a lot of advantage to setting up sharding before your data set is large.
Question 17. How Does Sharding Work With Replication?
Answer :
Each shard is a logical collection of partitioned data. The shard could consist of a single server or a cluster of replicas. We recommend using a replica set for each shard.
Question 18. What Happens If I Try To Update A Document On A Chunk That Is Being Migrated?
Answer :
The update will go through immediately on the old shard, and then the change will be replicated to the new shard before ownership transfers.
Question 19. What If A Shard Is Down Or Slow And I Do A Query?
Answer :
If a shard is down, the query will return an error unless the “Partial” query options is set. If a shard is responding slowly, mongos will wait for it.
RDBMS Interview Questions
Core Java Tutorial
Core Java Interview Questions
SQL Database Tutorial
SQL Database Interview Questions
Database Interview Questions
Hibernate Tutorial
Hibernate Interview Questions
RDBMS Interview Questions
Javascript Advanced Tutorial
Database Design Interview Questions
Software Development Lifecycle (SDLC) Tutorial
Database Administration Interview Questions
Core Java Interview Questions
MongoDB Tutorial