Interview questions and answers for 28 MongoDB nosql databases

Source: Internet
Author: User
Keywords Fragment what can if

MongoDB is currently the best document-oriented free Open-source NoSQL database. If you are preparing to participate in a technical interview for the MongoDB NoSQL database, you might want to look at the following MongoDB NoSQL interview questions and answers. These MongoDB NoSQL interview questions cover the basic concepts of NoSQL databases, replication (Replication), fragmentation (Sharding), Transactions and locks, trace analysis Tools (Profiler), nuances, and logging features. Let's take a look at the interview questions below for the MongoDB NoSQL database:




1. What do you mean by NoSQL database? What is the direct difference between NoSQL and RDBMS? Why use and not use the NoSQL database? What are some of the advantages of NoSQL database?


I wrote a full blog to answer these questions, look here


2. What are the types of NoSQL databases?


NoSQL Database Type


such as: MongoDB, Cassandra, CouchDB, hypertable, Redis, Riak, neo4j, HBASE, Couchbase, Memcachedb, Revendb and Voldemort are The examples of NoSQL databases. Read more.


3. What is the basic difference between MySQL and MongoDB?


MySQL and MongoDB are both free and open source databases. There are many basic differences between MySQL and MongoDB, including data representation, queries, relationships, transactions, schema design and definition, standardization (normalization), speed, and performance. By comparing MySQL and MongoDB, we are actually comparing relational and non relational databases. Read more


4. How do you compare MongoDB, Couchdb and couchbase?


Both MongoDB and COUCHDB are document-oriented databases. MongoDB and Couchdb are the most representative of open source NoSQL databases. They have nothing in common except that they are stored in document form. MongoDB and couchdb are different in terms of data model implementations, interfaces, object storage, and Replication methods.


details can be found in the links below:


mongdb vs CouchDB


CouchDB vs Couchbase


5. What is the reason for MongoDB to be the best NoSQL database?


The following features make MongoDB the best NoSQL database:


file-oriented


High Performance


High Availability


Extensibility


Rich Query Language

What are the nuances of
6.32-bit systems?


journaling activates additional memory-mapped files. This further suppresses the database size on the 32-bit version. Therefore, journaling is now disabled by default on 32-bit systems.


7. Journal Playback when the entry (entry) is incomplete (for example, happens to have a midway failure) will encounter problems?


each journal (group) write is consistent, unless it is complete otherwise it will not be replayed during the recovery process.


8. What is the role of the analyzer in MongoDB?


MongoDB includes a database analyzer that shows the performance characteristics of each operation in the database. With this parser you can find queries (or writes) that are slower than expected, and use this information, for example, to determine whether you need to add an index.


9. What is the name space (namespace)?


MongoDB Stores Bson objects in a cluster (collection). The database name and the cluster name are linked by a period called the namespace (namespace).


10. If the user removes the object's properties, is the property removed from the storage layer?


Yes, the user removes the attribute and then the object is saved (Re-save ()).


11. Can I use log features for a secure backup?


Yes.


12. Allow null value nulls?


for the object members, yes. However, the user cannot add null values (NULL) to the database Cluster (collection) because the null value is not an object. However, the user can add an empty object {}.


13. Update operation immediately fsync to disk?


No, the disk write operation defaults to deferred execution. The write operation may reach the disk after two or three seconds (the default is 60 seconds). For example, if the database receives 1000 incremental actions for one object in one second, only the disk is refreshed once. (Note that although the Fsync option is valid on the command line and after Getlasterror_old) (translator: Perhaps deceptive's face test??) )。


14. How do I perform a transaction/lock?


MongoDB does not use traditional locks or complex rollback transactions because it is designed for lightweight, fast, and predictable performance. It can be likened to the automatic submission mode of the MySQL Mylsam. By streamlining support for transactions, performance is enhanced, especially in a system that may pass through multiple servers.


15. Why is my data file so large?


MongoDB proactively allocates reserved space to prevent file system fragmentation.


16. How long does it take to enable backup recovery?


it will take 10-30 seconds to declare the primary database down from the backup database and to elect a backup database as the new primary database. Operations on the primary database will fail during this period-including write and strong-consistent read (fervent consistent read) operations. However, you can also perform a final consistency query on the second database (eventually consistent query) (in Slaveok mode), even during this time period.


17. What is master or primary?


It is the primary node/member of the current backup cluster (replica set) that handles all write operations. In a backup cluster, when a fail-back (failover) event occurs, an additional member becomes primary.


18. What is secondary or slave?


Seconday Copy the appropriate action from the current primary. It is done by tracking replication Oplog (local.oplog.rs).


19. Do I have to call GetLastError to make sure that the write operation is in effect?


not. Whether you call GetLastError (or "Safe Mode"), the server does the same thing. Call GetLastError only to confirm that the write operation was successfully committed. Of course, you often want to be sure, but the security of the write operation and whether it takes effect is not the decision.


20. Should I start out with sharded or with a non-sharded MongoDB environnement? Should I start a cluster fragment (sharded) or a MongoDB environment that is not a cluster fragment?


for the sake of development convenience, we recommend starting a MongoDB environment in a non-clustered fragmented (unsharded) manner, unless a server is not sufficient to store your initial dataset. Upgrading from non-clustered to cluster fragmentation (sharding) is seamless, so it is not necessary to consider cluster fragmentation (sharding) When your dataset is not very large.


21. How does fragmentation (sharding) and Replication (replication) work?


each fragment (shard) is a logical collection of partitioned data. Fragmentation may consist of a single server or cluster, and we recommend using clusters for each fragment (shard).


22. When will the data be extended to multiple slices (shard)?


MongoDB fragmentation is based on region (range). So all the objects in a set (collection) are stored in a block (chunk). Only if there are more than one block, will there be more than one fragment of the option to fetch data (only if there is much than 1 chunk is there a option for ListBox shards to get data.). Now, the size of each default block is 64Mb, so you need at least Mb of space to implement a migration.


23. What happens when I try to update a document on a block (chunk) that is being migrated?

The
update occurs immediately on the old fragment (Shard) before the change is replicated to the new fragment before the ownership transfer (ownership transfers).


24. What if I started a query when a fragment (shard) stopped or was slow?


If a fragment (Shard) is stopped, the query returns an error unless the query sets the "Partial" option. If a fragment (shard) response is slow, MongoDB waits for its response.


25. Can I delete the old files in the Movechunk directory?


no problem, these files are temporary files that are generated when the slice (shard) is balanced (balancing). Once these operations have been completed, the associated temporary files should also be deleted. But the cleanup is now manual, so be careful to consider releasing the files again.


26. How do I see the link that Mongo is using?


Db._admincommand ("Connpoolstats");


27. If block move operation (Movechunk) fails, do I need to manually clear the partially transferred document?


is not required, the move operation is consistent (consistent) and deterministic (deterministic); After a failure, the move operation is retried, and when completed, the data will only appear in the New Fragment (Shard).


28. If I am using replication technology (replication), can I use a portion of the log (journaling) while others are not?


can.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.