NODEJS Flashcards
What is the principal responsibility of a MongoDB driver? (Select one.)
b. Establishes secure connections to a MongoDB cluster and executes database operations on behalf of client applications.
The official MongoDB drivers adhere to each programming language’s best practices.
TRUE
How many MongoClient
instances should your application have when connecting to a single Atlas cluster? (Select one.)
1
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.)
username and password
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) {}
}
Add your IP address in the Network Access panel.
How can you fix the following error in a Node.js application? (Select all that apply.)
<pre>MongoServerError: bad auth : Authentication failed.</pre>
a. Update database access with the correct user credentials.
c. Check if your username and password are spelled correctly in your connection string.
How is BSON converted into JSON when using the MongoDB driver for Node.js? (Select one.)
a. BSON-encoded documents are converted automatically by the driver, allowing you to use the data immediately in your application.
What makes BSON documents different from JSON documents? (Select all that apply.)
a. BSON documents are binary encoded.
c. BSON documents allow for more data types than JSON documents.
What methods can be used to find a single document in a collection by using the MongoDB Node.js driver? (Select one.)
c. db.collection.findOne()
c. db.collection.findOne()
false
Which of the following ways can you update document(s) in a MongoDB database? (Select all that apply.)
a. updateOne() c. updateMany()
When a document is deleted by using the MongoDB Node.js driver, what information is returned? (Select one.)
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.
What is the aggregation framework used for? (Select one.)
a. Processing data records and returning computed results
Which component(s) of an aggregation pipeline do documents pass through for processing in sequence? (Select one.)
aggregation stages
Which of the following aggregation pipeline stages can be used to group data based on a key? (Select one.)
$group