Learn Node JS
Node js mango db
- Explain what is MongoDB?Mongo-DB is a document database which provides high performance, high availability and easy scalability.
- What is “Namespace” in MongoDB?MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the collection. The concatenation of the collection name and database name is called a namespace.
- What is sharding in MongoDB?The procedure of storing data records across multiple machines is referred as Sharding. It is a MongoDB approach to meet the demands of data growth. It is the horizontal partition of data in a database or search engine. Each partition is referred as shard or database shard.
- How can you see the connection used by Mongos?To see the connection used by Mongos use db_adminCommand (“connPoolStats”);
- Explain what is a replica set?A replica set is a group of mongo instances that host the same data set. In replica set, one node is primary, and another is secondary. From primary to the secondary node all data replicates.
- How replication works in MongoDB?Across multiple servers, the process of synchronizing data is known as replication. It provides redundancy and increase data availability with multiple copies of data on different database server. Replication helps in protecting the database from the loss of a single server.
- While creating Schema in MongoDB what are the points need to be taken in consideration?Points need to be taken in consideration are Design your schema according to user requirements Combine objects into one document if you use them together. Otherwise, separate them Do joins while write, and not when it is on read For most frequent use cases optimize your schema Do complex aggregation in the schema
- What is the syntax to create a collection and to drop a collection in MongoDB?Syntax to create collection in MongoDB is db.createCollection(name,options) Syntax to drop collection in MongoDB is db.collection.drop()
- Explain what is the role of profiler in MongoDB?MongoDB database profiler shows performance characteristics of each operation against the database. You can find queries using the profiler that are slower than they should be.
- To do safe backups what is the feature in MongoDB that you can use?Journaling is the feature in MongoDB that you can use to do safe backups.
- Mention what is Objecld composed of?Objectld is composed of Timestamp Client machine ID Client process ID 3 byte incremented counter
- Mention what is the command syntax for inserting a document?For inserting a document command syntax is database.collection.insert (document).
- Explain what are indexes in MongoDB?Indexes are special structures in MongoDB, which stores a small portion of the data set in an easy to traverse form. Ordered by the value of the field specified in the index, the index stores the value of a specific field or set of fields.
4iv>