WorksheetsNodejs: MongoDB
Total questions: 10
Worksheet time: 5mins
What is MongoDB primarily known as?
Relational Database Management System
Document-Oriented Database Management System
Graph Database Management System
Key-Value Database Management System
Which of the following is a valid data type in MongoDB?
String
Float
Date
All of the options
Which MongoDB operator is used to query for documents where a specific field's value is greater than a specified value?
$eq
$gt
$lt
$in
What is the purpose of the find method in MongoDB?
To update documents in a collection
To delete documents from a collection
To insert documents into a collection
To query documents in a collection
Which command is used to create a new table/collection in MongoDB if it doesn't exist?
db.createDatabase()
db.ensureDatabase()
db.newDatabase()
db.createCollection()
What is the default port number for MongoDB?
27017
8080
3000
5432
Which MongoDB operation is used to insert a new document into a collection?
db.collection.create()
db.collection.add()
db.collection.insertOne()
db.collection.updateOne()
Which MongoDB update method updates a single document matching the specified criteria
updateOne()
updateMany()
update()
findOneAndUpdate()
What happens if you attempt to update a document in MongoDB with the upsert option set to true, but the document does not exist
An error is thrown
A new document is inserted with the specified update.
The existing document is updated.
Nothing happens.
Which MongoDB method is used to remove a single document from a collection that matches a specified query?
db.collection.delete()
db.collection.removeOne()
db.collection.deleteOne()
db.collection.remove()
