NODEJS Flashcards

1
Q

What is the principal responsibility of a MongoDB driver? (Select one.)

A

b. Establishes secure connections to a MongoDB cluster and executes database operations on behalf of client applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The official MongoDB drivers adhere to each programming language’s best practices.

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many MongoClient instances should your application have when connecting to a single Atlas cluster? (Select one.)

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which component(s) of the connection string do you need to replace when pasting a connection string from Atlas into a code file? (Select all that apply.)

A

username and password

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you fix the following error in a Node.js application? (Select one.)

MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at Timeout._onTimeout (/Users/admin/dev/node-mongodb-native/lib/sdam/topology.js:293:38)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
reason: TopologyDescription {
type: ‘Unknown’,
servers: Map(1) { ‘localhost:27017’ => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
},
code: undefined,
[Symbol(errorLabels)]: Set(0) {}
}

A

Add your IP address in the Network Access panel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you fix the following error in a Node.js application? (Select all that apply.)

<pre>MongoServerError: bad auth : Authentication failed.</pre>

A

a. Update database access with the correct user credentials.
c. Check if your username and password are spelled correctly in your connection string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How is BSON converted into JSON when using the MongoDB driver for Node.js? (Select one.)

A

a. BSON-encoded documents are converted automatically by the driver, allowing you to use the data immediately in your application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What makes BSON documents different from JSON documents? (Select all that apply.)

A

a. BSON documents are binary encoded.
c. BSON documents allow for more data types than JSON documents.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What methods can be used to find a single document in a collection by using the MongoDB Node.js driver? (Select one.)

A

c. db.collection.findOne()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

c. db.collection.findOne()

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following ways can you update document(s) in a MongoDB database? (Select all that apply.)

A

a. updateOne() c. updateMany()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When a document is deleted by using the MongoDB Node.js driver, what information is returned? (Select one.)

A

c. An object that contains an acknowledged property that’s set to a boolean, and a deletedCount property that’s set to the number of documents that were deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the aggregation framework used for? (Select one.)

A

a. Processing data records and returning computed results

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which component(s) of an aggregation pipeline do documents pass through for processing in sequence? (Select one.)

A

aggregation stages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following aggregation pipeline stages can be used to group data based on a key? (Select one.)

A

$group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following aggregation pipeline stages can be used to filter data based on specific conditions? (Select one.)

A

$match

17
Q

Which of the following aggregation stages organizes the results of the pipeline in ascending or descending order? (Select one.)

A

$sort

18
Q

Which of the following aggregation pipeline stages is used to pass documents with the requested fields to the next stage in the pipeline? (Select one.)

A

$project