Basic Flashcards
default port
27017
show databases from cli
show dbs
show collections from cli
show collections
switch to a database from cli
use databasename
what is mongodb
Mongo-DB is a document database which provides high performance, high availability and easy scalability.
What is a namespace
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
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 connections used my mongo
To see the connection used by Mongos use db.runCommand(“connPoolStats”)
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 does replication work
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.
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 the command syntax for inserting a document?
For inserting a document command syntax is database.collection.insert (document).
What is the command syntax that tells you whether you are on the master server or not? And how many master does MongoDB allow?
Command syntax Db.isMaster() will tell you whether you are on the master server or not. MongoDB allows only one master server, while couchDB allows multiple masters.