Basics Flashcards

1
Q

Advantages of MongoDB over RDBMS?

A

Schema less− MongoDB is a document database in which one collection holds different documents. Number of fields, content and size of the document can differ from one document to another.

Structure of a single object is clear.

No complex joins.

Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL.

Tuning.

Ease of scale-out− MongoDB is easy to scale.

Conversion/mapping of application objects to database objects not needed.

Uses internal memory for storing the (windowed) working set, enabling faster access of data.

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

Why use MongoDb?

A

Document Oriented Storage− Data is stored in the form of JSON style documents.

Index on any attribute

Replication and high availability

Auto-sharding

Rich queries

Fast in-place updates

Professional support by MongoDB

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

Where to use MongoDb

A

Big Data

Content Management and Delivery

Mobile and Social Infrastructure

User Data Management

Data Hub

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

db.stats()

A

This will show the database name, number of collection and documents in the database.

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

What makes MongoDB the best?

A
MongoDB is considered to be best NoSQL database because of :Document-oriented (DO)
High performance (HP)
High availability (HA)
Easy scalability
Rich query language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to do transactions/locking in MongoDB?

A

MongoDB does not use conventional locking with reduction, as it is planned to be light, high-speed and knowable in its presentation. It can be considered as parallel to the MySQL MyISAM auto entrust sculpt. With simplest business sustain, performance is enhanced, particularly in a structure with numerous servers.

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

When and to what extent does Data get extended to Multi-slice?

A

The MongoDB scrap stands on a collection. So an album of all substances is kept in a lump or mass. Only when there is an additional time slot, there will be more than a few slice data achievement choices, but when there is more than 1 lump, data gets extended to a lot of slices and it can be extended to 64 MB.

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

When do we use Namespace in MongoDB?

A

During sequencing of the names of the database and collection name Namespace is used.

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

If you remove an object attribute, is it deleted from the database?

A

Yes, it is deleted. So better eliminate the attribute and then save the object again.

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

How can we move the old file in the moveChunk directory?

A

Once the functions are done, the old files are converted to backup files and moved to the moveChunk directory at the time of balancing the slices.

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

Explain the situation when an index does not fit into RAM?

A

When an index is too huge to fit into RAM, then MongoDB reads the index, which is faster than reading RAM because the indexes easily fit into RAM if the server has got RAM for indexes along with the remaining set.

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

How does MongoDB provide consistency?

A

MongoDB uses the reader-writer locks, allowing simultaneous readers to access any supply like a database or any collection. But always offers private access to singles writes.

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

Why is MongoDB not chosen for a 32-bit system?

A

ngo DB is not considered as a 32-bit system because for running the 32-bit MongoDB, with the server, information and indexes require 2 GB. So only it is not used in 32-bit devices.

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

How does Journaling work in MongoDB?

A

Write operations are saved in the memory while journaling is going on. The on-disk journal files are really dependable for the reason that the journal writes are habitual. Inside dbPath, a journal subdirectory is designed by MongoDB.

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

How can you isolate our cursors from intervening with the write operations?

A

Snapshot () method is used to isolate cursors from intervening with writes. This method negotiates the index and makes sure that each query comes to any article only once.

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

Define MongoDB.

A

It is document oriented database which is used to high availability, easy scalability and high performance. It supports the dynamic schema design.

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

Explain replica set.

A

It is a group of mongo instances that maintain same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.

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

What are the key features of mongodb

A

There are 3 main features of mongodb that are automatic scaling, High performance and high availability.

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

What is CRUD?

A

Mongodb provides CRUD operations that are create, Read, Update, Delete.

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

What is sharding?

A

Sharding means to store the data on the multiple machines.

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

What is Aggregation in MongoDB?

A

Aggregations are operations that process data records and return computed results.

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

Define the namespace in mongodb?

A

It is the concatenation of collection name and database.

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

Which syntax is used to create collection in mongodb?

A

db.createCollection(name,options) is used to create collection in mongodb.

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

Which syntax is used to drop collection in mongodb?

A

db.collection.drop() is used to drop collection in mongodb.

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

Explain Replication

A

Replication is the process of synchronizing data across multiple servers.

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

What is the use of Index in mongodb?

A

Indexes provide high performance read operations for frequently used queries.

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

Which command is used for inserting a document?

A

database.collection.insert (document) is used for inserting a document.

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

What is use of GridFS in mongodb?

A

GridFS is used for storing and retrieving the large files like audio, Images, Video files.

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

What is the use journaling?

A

Journaling is used to safe backups in mongodb.

30
Q

Which command is used to see the connection?

A

db_adminCommand (“connPoolStats”); is used to see the connection.

31
Q

Define primary replica sets?

A

The primary replica set accepts all write operations from clients.

32
Q

Define secondary replica sets.

A

The secondaries (page 565) replicate the primary’s oplog and apply the operations to their data sets such that the secondaries’ data sets reflect the primary’s data set.

33
Q

What is the use of profiler?

A

Profiler is used to show the performance characteristics of every operation against the database.

34
Q

Which type of data mongodb store?

A

MongoDB stores data in the form of documents, which are JSON-like field and value pairs.

35
Q

What is purpose of replication?

A

Replication provides redundancy and increases data availability.

36
Q

what is embedded documents?

A

Embedded documents capture relationships between data by storing related data in a single document structure.

37
Q

Define application level encryption

A

Application Level Encryption provides encryption on a per-field or per-document basis within the application layer.

38
Q

What is storage encryption?

A

Storage Encryption encrypts all MongoDB data on the storage or operating system to ensure that only authorized processes can access protected data.

39
Q

Which method is used to create an index?

A

CreateIndex() method is used to create an index.

40
Q

What is replica set oplog?

A

The oplog records all operations that modify the data in the replica set.

41
Q

What is vertical scaling?

A

Vertical scaling adds more CPU and storage resources to increase capacity.

42
Q

Define horizontal scaling.

A

It divides the data set and distributes the data over multiple servers, or shards.

43
Q

What are the components of shared cluster?

A

Sharded cluster has the following components: shards, query routers and config servers.

44
Q

Which command is use to create database?

A

DATABASE_NAME command is used to create database.

45
Q

Which command is use to drop database?

A

db.dropDatabse() command is used to drop the database.

46
Q

What is the use of pretty() method?

A

Pretty() method is used to show the results in a formatted way.

47
Q

Which method is used to remove the document form the collection?

A

Remove() method is used to remove the document form the collection.

48
Q

Define Mongodb projection.

A

Projection is used to select only necessary data.It did not select whole data of a document.

49
Q

What is the use of limit() method?

A

Limit() method is used to limit the records in database

50
Q

What is the syntax of limit() method?

A

> db.COLLECTION_NAME.find().limit(NUMBER) syntax is used.

51
Q

hat is the syntax of sort() method?

A

> db.COLLECTION_NAME.find().sort({KEY:1}) syntax is used for sorting the documents.

52
Q

Which command is used to create the backup of database?

A

Mongodump command is used to create the backup of database.

53
Q

What is collection in monodb?

A

In monogodb collection is a group of mongodb documents.

54
Q

What is the use of db command?

A

Db command gives the name of currently selected database.

55
Q

Which method is used to update the documents into a collection?

A

Update() and save() methods are used to update the documents into a collection.

56
Q

What is the syntax of skip() method?

A

The syntax of skip methopd is >db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER).

57
Q

Which command is used to restore the backup?

A

Mongorestore command is used to restore the backup.

58
Q

What is the use of Dot notation in mogodb?

A

MongoDB uses the dot notation to access the elements of an array and to access the fields of an embedded document.

59
Q

Define auditing.

A

Auditing provides administrators with the ability to verify that the implemented security policies are controlling activity in the system.

60
Q

Define Aggregation Pipeline.

A

It is a framework for performing aggregation tasks. The pipeline is used to transform the documents into aggregated results.

61
Q

Define Map reduce.

A

Map-reduce is a generic multi-phase data aggregation modality which is used for processing quantities of data.

62
Q

What is splitting in mongodb?

A

It is a background process that is used to keep chunks from growing too large.

63
Q

Which language is used to wite mongodb?

A

C++ language is used for writing and implementing mongodb.

64
Q

In which format mongodb stores the data?

A

Mongodb uses collection to store the data rather than in table.

65
Q

What is the use of save() method?

A

Save() method is used to replace the existing document to the new document.

66
Q

What is MongoDB?

A

MongoDB (from humongous) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software.

First developed by the software company 10gen (now MongoDB Inc.) in October 2007 as a component of a planned platform as a service product, the company shifted to an open source development model in 2009, with 10gen offering commercial support and other services. Since then, MongoDB has been adopted as backend software by a number of major websites and services, including Craigslist, eBay, Foursquare, SourceForge, Viacom, and the New York Times, among others. MongoDB is the most popular NoSQL database system.

67
Q

What is the use of MongoDB?

A

MongoDB is relational database management system (RDBMS) replacement for web applications. So when you have something which is close to RDBMS, MongoDB could be of good use. It gives you that additional partition tolerance which RDMBS doesn’t give but it has problems with availability. But if you want more scalability, MongoDB would be your choice.

It’s suitable for real-time analytics and high speed logging. It’s highly scalable as well. Craigslist uses MongoDB for archived posts.

68
Q

What do you understand by NoSQL databases? Is MongoDB a NoSQL database? Explain.

A

At the present time, the internet is loaded with big data, big users, big complexity etc. and also becoming more complex day by day. NoSQL is answer of all these problems; it is not a traditional database management system, not even a relational database management system (RDBMS). NoSQL stands for “Not Only SQL”. NoSQL is a type of database that can handle and sort all type of unstructured, messy and complicated data. It is just a new way to think about the database.Yes. MongoDB is a NoSQL database.

69
Q

What type of DBMS is MongoDB?

A

MongoDB is a document oriented DBMS

70
Q

What is the difference between MongoDB and MySQL?

A

Although MongoDB and MySQL both are free and open source databases, there is a lot of difference between them in the term of data representation, relationship, transaction, querying data, schema design and definition, performance speed, normalization and many more. To compare MySQL with MongoDB is like a comparison between Relational and Non-relational databases.

71
Q

What is the use of MongoDB?

A

MongoDB is typically used as the primary data store for operational applications with real-time requirements (i.e., low-latency, high availability). MongoDB is generally a good fit for 60%-80% of the applications you may be building today. MongoDB is easy to operate and scale in ways that are hard if not impossible with relational databases.
MongoDB excels in many use cases where relational databases aren’t a good fit, like applications with unstructured, semi-structured and polymorphic data, as well as applications with large scalability requirements or multi-data center deployments.
MongoDB may not be a good fit for some applications. For example, applications that require complex transactions (e.g., a double-entry bookkeeping system) and scan-oriented applications that access large subsets of the data most of the time may not be a good fit for MongoDB. MongoDB is not a drop-in replacement for legacy applications built around the relational data model and SQL.
Some common use cases include mobile apps, product catalogs, real-time personalization, content management and applications delivering a single view across multiple systems

72
Q

While creating Schema in MongoDB what are the points need to be taken in consideration?

A

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 schemaThis blog will help you get a better understanding of Difference Between Cassandra and MongoDB!