wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Nodejs: MongoDB

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is MongoDB primarily known as?

a)

Relational Database Management System

b)

Document-Oriented Database Management System

c)

Graph Database Management System

d)

Key-Value Database Management System

2.

Which of the following is a valid data type in MongoDB?

a)

String

b)

Float

c)

Date

d)

All of the options

3.

Which MongoDB operator is used to query for documents where a specific field's value is greater than a specified value?

a)

$eq

b)

$gt

c)

$lt

d)

$in

4.

What is the purpose of the find method in MongoDB?

a)

To update documents in a collection

b)

To delete documents from a collection

c)

To insert documents into a collection

d)

To query documents in a collection

5.

Which command is used to create a new table/collection in MongoDB if it doesn't exist?

a)

db.createDatabase()

b)

db.ensureDatabase()

c)

db.newDatabase()

d)

db.createCollection()

6.

What is the default port number for MongoDB?

a)

27017

b)

8080

c)

3000

d)

5432

7.

Which MongoDB operation is used to insert a new document into a collection?

a)

db.collection.create()

b)

db.collection.add()

c)

db.collection.insertOne()

d)

db.collection.updateOne()

8.

Which MongoDB update method updates a single document matching the specified criteria

a)

updateOne()

b)

updateMany()

c)

update()

d)

findOneAndUpdate()

9.

What happens if you attempt to update a document in MongoDB with the upsert option set to true, but the document does not exist

a)

An error is thrown

b)

A new document is inserted with the specified update.

c)

The existing document is updated.

d)

Nothing happens.

10.

Which MongoDB method is used to remove a single document from a collection that matches a specified query?

a)

db.collection.delete()

b)

db.collection.removeOne()

c)

db.collection.deleteOne()

d)

db.collection.remove()