WorksheetsMongoDB Quiz
Total questions: 30
Worksheet time: 15mins
What does NoSQL stand for?
Not Only SQL
No Structured Query Language
Non-Standard Query Language
None of the above
Which of the following is NOT a characteristic of NoSQL databases?
Schema flexibility
High availability
Fixed schema
Horizontal scalability
What type of data model does MongoDB use?
Key-Value Store
Document Store
Column Family Store
Graph Database
In MongoDB, what is a collection?
A single data record
A grouping of related documents
A type of database
A field within a document
Which command is used to create a new collection in MongoDB?
createCollection()
insertCollection()
newCollection()
addCollection()
When inserting a document in MongoDB, which method is used?
addOne()
insert()
insertOne()
create()
What is the default port for MongoDB?
8080
27017
5432
3306
Which command would you use to connect to a MongoDB server?
mongo connect
mongo --connect
mongo
connect mongo
What is the purpose of creating indexes in MongoDB?
To speed up data insertion
To speed up data retrieval
To compress data
To secure data
Which MongoDB command is used to delete a document?
drop()
delete()
remove()
deleteOne()
In MongoDB, which role provides read and write access to a database?
read
readWrite
dbAdmin
userAdmin
What is the primary function of user roles in MongoDB?
To manage data
To define user permissions
To create collections
To enforce data integrity
What command is used to enable access control in MongoDB?
setAuth()
--auth
enableAuth()
startAuth()
How can you create an admin user in MongoDB?
db.createAdminUser()
db.createUser()
db.createAdmin()
db.addUser()
What is the use of the aggregation framework in MongoDB?
To perform complex data operations
To create indexes
To define user roles
To backup databases
Which of the following would you use to connect to MongoDB from a Node.js application?
MongoClient
MongoDBClient
NodeMongoClient
MongoDBConnection
In a Node.js application, which package is used to interact with MongoDB?
mongodb
mongo-driver
mongo-package
db-mongo
When performing CRUD operations, which method would you use to update a document in MongoDB?
updateRecord()
updateOne()
modify()
changeOne()
Which command is used to create a unique index on a field in a MongoDB collection?
createIndex({ field: 1 })
createUniqueIndex({ field: 1 })
createIndex({ field: 1 }, { unique: true })
addIndex({ field: 1 })
What does BSON stand for in MongoDB?
Binary Standard Object Notation
Binary JSON
Basic Structured Object Notation
Binary Structured Object Notation
Which command is used to view all collections in the current database?
show collections
list collections
display collections
get collections
What is the purpose of the use command in MongoDB?
To switch to a different database
To create a new collection
To insert a document
To delete a database
What method would you use to find all documents in a collection?
findAll()
getAll()
find()
query()
How do you drop a collection in MongoDB?
dropCollection()
removeCollection()
db.collection.drop()
deleteCollection()
In a MongoDB document, what is a field?
A type of collection
A single record
A key-value pair
A database identifier
What is a capped collection in MongoDB?
A collection with a fixed size
A collection that cannot be deleted
A collection that only allows unique values
A collection with unlimited size
Which command is used to create a backup of a MongoDB database?
mongodump
backupMongo
dumpMongo
createBackup
In Node.js, what is the purpose of the client.close() method?
To disconnect from the database
To delete the database
To remove the client object
To close the application
Which method would you use to aggregate data in MongoDB?
aggregateData()
processData()
aggregate()
summarize()
How do you enable schema validation in MongoDB?
By creating a schema with createCollection()
By using createSchema()
By setting validation rules in the database
By adding a validation flag to the collection
