SWDND501:NOSQL DATABASE DEVELOPMENT
LO1:Prepare database environment
IC2.Analysing nosql database
Topic1. Describe requirements analysis process
ANSWER ALL QUESTIONS
GROUPWORK1 CORRECTION
QUESTIONS
1. What is the primary advantage of using a NoSQL database like MongoDB?
ANS:The primary advantage of using a NoSQL database like MongoDB is
its ability to handle large amounts of unstructured or semi-structured
data with flexible schema designs.
2. How do you create a new database in MongoDB using the MongoDB
Shell? ANS: You can create a new database in MongoDB using the
MongoDB Shell by running the command use mydatabase
3. What is the purpose of indexing in MongoDB? Ans:The purpose of
indexing in MongoDB is to improve query performance by allowing
MongoDB to quickly locate specific data without having to scan the entire
collection.
4. How do you establish relationships between documents in MongoDB?
ans: You can establish relationships between documents in MongoDB
using references or embedded documents.
5. What is the difference between a collection and a document in MongoDB?
ans:A collection is a group of documents, while a document is a single
record or entry in a collection.
6. How do you ensure data consistency in a distributed MongoDB cluster?
Ans:You can ensure data consistency in a distributed MongoDB cluster by
using replication and distributed transactions.
7. What is optimistic locking, and how is it used in MongoDB? Ans:Optimistic
locking is a concurrency control mechanism that assumes multiple
transactions can complete without conflicts, and only checks for conflicts
when a transaction is about to commit.
8. What is the role of the mongod process in a MongoDB environment?
Ans:You can scale a MongoDB cluster horizontally by adding more nodes
to the cluster.
9. What is the difference between MongoDB Compass and MongoDB Atlas?
Ans:MongoDB Compass is a GUI for MongoDB, while MongoDB Atlas is a
cloudbased MongoDB service.
10. How do you create a new user in MongoDB using the MongoDB Shell?
Ans:You can create a new user in MongoDB using the MongoDB Shell by
running the command db.createUser({ user: "myuser", pwd:
"mypassword", roles: ["readWrite"] })
11. . What is the purpose of the mongo shell in MongoDB?
Ans:The mongo shell is a command-line interface for interacting with
MongoDB instances.
12. How do you perform data modeling in MongoDB?
Ans:You can perform data modeling in MongoDB by defining a data
model that represents the structure and relationships of the data.
13. What is the difference between a NoSQL database and a relational
database?
Ans: Relational databases require a predefined schema, enforcing a
structured format for data storage. This ensures data consistency and
integrity but can limit flexibility. NoSQL databases embrace a schema-
less or flexible schema, allowing for the storage of unstructured or semi-
structured data
14. How do you handle data migration in MongoDB?
Ans: keep the MongoDB Atlas cluster updated with changes in the source
database. Change your application or workload to access the data in the
MongoDB Atlas cluster.
15. .What is the purpose of data normalization in MongoDB?
Ans:Normalization is the process of organizing data in a database
to reduce redundancy and improve data integrity. In MongoDB,
normalization can be achieved by dividing data into multiple collections
and using references to connect the data between collections.
16. What is the role of replication in a MongoDB cluster?
Ans: Replication in MongoDB is the process of copying data across
multiple servers, which helps in both durability and fault tolerance. A
MongoDB cluster typically consists of multiple nodes (servers), where one
node is designated as the primary node (also known as the master), and
the others are secondary nodes (slaves).
17. What is a database cluster in MongoDB?
Ans:MongoDB cluster allows a MongoDB database to either horizontally
scale across many servers with sharding, or to replicate data ensuring
high availability with MongoDB replica sets, therefore enhancing the
overall performance and reliability of the MongoDB cluster.