0% found this document useful (0 votes)
6 views5 pages

Unit 3 Two Marks

The document provides an overview of MongoDB and NoSQL databases, highlighting their features, data types, and commands. It explains the differences between MongoDB and SQL, the creation and management of users, collections, and documents, as well as data processing using Map Reduce. Additionally, it covers index creation and the syntax for updating documents in MongoDB.

Uploaded by

poo2290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Unit 3 Two Marks

The document provides an overview of MongoDB and NoSQL databases, highlighting their features, data types, and commands. It explains the differences between MongoDB and SQL, the creation and management of users, collections, and documents, as well as data processing using Map Reduce. Additionally, it covers index creation and the syntax for updating documents in MongoDB.

Uploaded by

poo2290
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIT-III

MONGO DB

PART-A

Q.1 What is NoSQL?

NoSQL stands for not only SQL. It is nontabular database system that store data differently than
relational tables. There are various types of NoSQL databases such document, key-value, wide
column and graph.Using NoSQL we can maintain flexible schemas and these schemas can be
scaled easily with large amount of data.

Q.2 Enlist the features of NoSQL.

1) The NoSQL does not follow any relational model.

2) It is either schemas free or have relaxed schema. That means it does not require specific

definition of schema.

3) Multiple NoSQL databases can be executed in distributed fashion

4) It can process both unstructured and semi-structured data.

5) The NoSQL have higher scalability.

Q.3 Enlist the features of MongoDB.

It is a schema-less, document based database system.

2) h provides high performance data persistence.

3) It supports multiple storage engines.

4) It has a rich query language support.

5) MongoDB provides high availability and redundancy with the help of replication

That means it creates multiple copies of the data and sends these copies to a different server so
that if one server fails, then the data is retrieved from another server.

Q.4 How the terms in MongoDB are different from SQL?

The terms in SQL are treated differently in MongoDB. In MongoDB the data is not stored in
tables, instead of that, the there is a concept called collection which is analogous to the tables. In
the same manner the rows in RDBMS are called documents in MongoDB. likewise Q.5 Explain
the createUser command in MongoDB the columns of the record in RDBMS are called fields.

Q.5 Explain the createUser command in mongodb.

. The user accounts are created using the createUser() method.

Syntax

dh.createUser(user, writeConcern)

Parameters

user: Is a document with authentication and access information about the user to create.

writeConcern: This document represents the level of write concern for creation operation.

Q.6 How remove users from MongoDB ?

For removing the user, the db.dropUser() is used.

Syntax

dis dropUser(username)

Q.7 Enlist any four data types in MongoDB.

Following are various types of data types supported by MongoDB.

1) Integer: This data type is used for storing the numerical value

2) Boolean: This data type is used for implementing the Boolean values Le true or false

3) Double: Double is used for storing floating point data.

4) String: This is the most commonly used data type used for storing the string values.

5) Min/Max keys: This data type is used to compare a value against the lowest of highest

BSON element.

6) Arrays: For storing an array or list of multiple values in one key, this data type is used .

Q.8 Explain how to create collection in MongoDB ?

After creating some sample database we must create some collection males database.

We can create collection explicitly using createCollection command.


Syntax

db.createCollection(name.options)

where

name is the name of collection

options is an optional field. This field is used to specify some parameters such as size, maximum
number of documents and so on.

Q.9 How to insert multiple documents in a MongoDB database?

It is possible to insert multiple documents at a time using a single command. Following


command shows how to insert multiple documents in the existing collection.

>var =allStudent=

[{

'name': AAA.

"age”: 20},

"name": BBB,

"age”: 21},

"name": CCC,

“ age” 22

},

];

>db.Student details.insert(allStudents);

Q.10 Explain the MongoDBClient in detail.

The MongoDBClient object provides interactions to connect to the database. Following are some
commonly used method of MongoDBClient object.

Method
 connect(url.options)

 close(force, callback)

 db(dbname, options)

 isConnected(options)

Purpose

 This method is used to connect to the MongoDB using the specified url.

 This method closes the db and underlying connections.

 It creates a new DBS instance sharing the cumm socket comection

 It checks if MongoClient is connected

Q.ll What is Map reduce ?

Map reduce is a data processing programming model that helps in performing operations large
data sets and produce aggregate results. A Map reduce is used for large volume of data. The
syntax for map reduce is

1) map function: It uses emit() function in which it takes two parameters key and value key.
Here the key is on which we make groups(such as group by name, or age) and the second
parameter is on which aggregation is performed like avg(), sum() is calculated on.

2) reduce function: This is a function in which we perform aggregate functions like avg().

3) out: It will specify the collection name where the result will be stored.

4) query: We will pass the query to filter the resultset.

5) sort: It specifies the optional sort criteria.

6) limit: It specifies the optional maximum number of documents to be returned.

Q.12 What is syntax for Index creation?

syntax:

db.<collection>.createIndex({KEY:1})
Q.13 What are the datatypes in mongodb?

Integer: This data type is used for sorting the numerical value.\

Double: Double is used for sorting floating point data.

Null: For sorting the null values this data type is used.

Q.14 What is mean by update documents?

For updating the document we have to provide some criteria based on which the document can
be updated.

Syntax:

Db.collection_name.update(criteria,update_data)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy