Basic Flashcards

1
Q

default port

A

27017

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

show databases from cli

A

show dbs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

show collections from cli

A

show collections

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

switch to a database from cli

A

use databasename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is mongodb

A

Mongo-DB is a document database which provides high performance, high availability and easy scalability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a namespace

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is sharding

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how can you see the connections used my mongo

A

To see the connection used by Mongos use db.runCommand(“connPoolStats”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is a replica set

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does replication work

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the syntax to create a collection and to drop a collection in MongoDB?

A

Syntax to create collection in MongoDB is db.createCollection(name,options)

Syntax to drop collection in MongoDB is db.collection.drop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain what is the role of profiler in MongoDB?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

To do safe backups what is the feature in MongoDB that you can use?

A

Journaling is the feature in MongoDB that you can use to do safe backups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Mention what is the command syntax for inserting a document?

A

For inserting a document command syntax is database.collection.insert (document).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the command syntax that tells you whether you are on the master server or not? And how many master does MongoDB allow?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Explain what are indexes in MongoDB?

A

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.

17
Q

Explain what is GridFS in MongoDB?

A

For storing and retrieving large files such as images, video files and audio files GridFS is used. By default, it uses two files fs.files and fs.chunks to store the file’s metadata and the chunks.