endterm

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

7. Which stage in MongoDB aggregation framework allows you to limit the number of documents returned from the pipeline? $sort $match $group $limit верно

$limit

8. Which stage in MongoDB aggregation framework allows you to skip a specified number of documents before starting to return documents? $sort $match $group $skip верно

$skip

3. Which stage in MongoDB aggregation framework allows you to rearrange documents based on a specified expression? $sort $match $group $project

$sort

7. What is the maximum number of array fields per multikey index? (Select one.) 1 3 5 Unlimited верно

1

2. What is the maximum size limit for a single aggregation pipeline in MongoDB? 16MB 32MB 64MB 128MB верно

32MB

What is a single field index? (Select one.) Correct Answer A. An index that supports efficient querying against one field B. An index that supports efficient querying against multiple fields C. An index that only supports efficient querying against fields with scalar values D. An index that supports efficient querying against fields that are already indexed by another user-defined index

A. An index that supports efficient querying against one field Your Answer: Correct Correct. A single field index is an index that supports efficient querying against a single field. By default, all collections have a single field index on the _id field, but users can define additional indexes that support important queries. A single field index is also a multikey index if the value of the field is an array.

Which of the following statements describe a B tree? (Select all that apply.) A. B trees sort the stored data in ascending sequential order from left to right B. Nodes in a B tree can have more than two child nodes C. B tree stands for Binary tree D. A B tree is a self-balancing tree data structure

A. B trees sort the stored data in ascending sequential order from left to right B. Nodes in a B tree can have more than two child nodes D. A B tree is a self-balancing tree data structure

You check the executionStats for a query using an index and see the following output: { executionSuccess: true, nReturned: 2, executionTimeMillis: 0, totalKeysExamined: 3, totalDocsExamined: 3, ... } Which of the following is true? (Select all that apply.) A. MongoDB had to scan an extra document B. Two documents were returned C. MongoDB had to scan an extra index key D. This query is not using an index

A. MongoDB had to scan an extra document B. Two documents were returned C. MongoDB had to scan an extra index key

Instructions: Select an answer choice and then click "See Results" to submit. You have a collection that contains zip codes in the United States. Here's a sample document from this collection: _id: ObjectId('5c8eccc1caa187d17ca6eea2') city: "EVERGREEN" zip: "36401" loc: Object y: 31.458009 x: 86.925771 pop: 8556 state: "AL" What will the output of this aggregation pipeline be? (Select one.) db.zips.aggregate([ { $match: { "state": "TX" } }, { $group: { "_id": "$city" } } ]) A. One document for each city located in Texas (TX) B. One document containing all cities located in Texas (TX) C. One document for each state in United States except Texas (TX) D. All documents that contain a city where the state is Texas (TX)

A. One document for each city located in Texas (TX)

What happens when the database profiler is enabled on a database? (Select one.) A. Operations are captured and recorded inside the database under a capped collection named system.profile. B. A web server is enabled to support queries on the database. C. You'll receive suggestions for actions you can take on your database to improve performance. D. The MongoDB instance is profiled in order to find the source of out-of-memory errors.

A. Operations are captured and recorded inside the database under a capped collection named system.profile.

Given the following query: db.zips.find({ state: "AZ", pop: { $gte: 20000} }) Which Partial index will support this query? (Select one.) A. db.zips.createIndex( { state: 1 }, { partialFilterExpression: { pop: { $gte: 10000 } } } ); B. db.zips.createIndex( { state: 1 }, { partialFilterExpression: { pop: { $lte: 10000 } } } ); C. db.zips.createIndex( { state: 1 }, { partialFilterExpression: { pop: { $gte: 25000 } } } ); A. Option A B. Option B C. Option C

A. Option A

Which index would most effectively support the following query? (Select one.) db.collection.find({ username: "j0hnny", timestamp: { $gte: ISODate("2021-05-18T00:00:00.000Z"), $lt: ISODate("2021-05-18T13:00:00.000Z") }}) A. db.collection.createIndex({ username: 1, timestamp: 1 }) B. db.collection.createIndex({ timestamp: 1, username: 1 }) C. db.collection.createIndex({ username: 1 }) D. db.collection.createIndex({ timestamp: 1 }) Correct Answer A. Option A B. Option B C. Option C D. Option D

A. Option A

What happens if you set the $out stage to output to a collection that already exists? (Select one.) A. The existing collection is erased and replaced with the outputted documents. B. A second collection with "_1" appended to the name is created. C. A new database with the specified name of the collection is created. D. An error is returned, and the existing collection is not modified.

A. The existing collection is erased and replaced with the outputted documents.

What is the correct definition of a time series collection? (Select one.) A. Time series collections efficiently store time series data. In time series collections, writes are organized so that data from the same source is stored alongside other data points from a similar point in time. B. Time series collections is a specialized collection that stores time-related data in multiple time zones for easy lookup. C. Time series collections are collections of documents that are grouped together into a single bucket based on the total size of the documents. D. Time series collections are fixed-size collections that support high-throughput operations that insert and retrieve documents based on insertion order.

A. Time series collections efficiently store time series data. In time series collections, writes are organized so that data from the same source is stored alongside other data points from a similar point in time.

When should you use a partial index? (Select one.) A. To index documents that match a specified filter document. B. To index based on ranges of documents rather than individual documents. C. To support queries against time series data. D. To index a field that has a value of an array.

A. To index documents that match a specified filter document.

The SORT stage will be present in the executionStages object of the explain('executionStats') output if a blocking (in-memory) sort took place. Correct Answer A. True B. False

A. True

Which of the following tasks cannot be completed with an aggregation pipeline? (Select one.) Correct Answer A. Filtering for relevant pieces of data B. Finding data from outside sources C. Grouping documents D. Calculating total values from a field across many documents

B. Finding data from outside sources

When can we create a clustered index? (Select one.) A. When creating the clustered collection B. Anytime C. When dropping the clustered collection D. When creating secondary indexes

A. When creating the clustered collection Your Answer: Correct

Which of the following fields can help us determine the effectiveness of an index? (Select all that apply.) A. nReturned B. executionSuccess C. totalDocsExamined D. executionStages E. totalKeysExamined

A. nReturned C. totalDocsExamined D. executionStages E. totalKeysExamined

9. What is a compound index? (Select one.) An index that supports queries that combine the field name and the value into one string An index that supports queries against unknown or arbitrary fields An index that contains references to multiple fields within a document An index that supports queries that are run on two collections at the same time

An index that contains references to multiple fields within a document

4. What is a single-field index? (Select one.) An index that supports efficient querying against a single field An index that supports efficient querying against multiple fields An index that doesn't support efficient querying against fields that have an array value An index that supports efficient querying against fields that are already indexed by another user-defined index

An index that supports efficient querying against a single field

4. What is a single-field index? (Select one.) An index that supports efficient querying against a single field An index that supports efficient querying against multiple fields An index that doesn't support efficient querying against fields that have an array value An index that supports efficient querying against fields that are already indexed by another user-defined index верно

An index that supports efficient querying against a single field

6. What is a multikey index? (Select one.) An index on one field only where the field is not an array An index where one of the indexed fields contains an array An index on more than one field where none of the fields are arrays An index on more than one field where multiple fields are arrays

An index where one of the indexed fields contains an array

6. What is a multikey index? (Select one.) An index on one field only where the field is not an array An index where one of the indexed fields contains an array An index on more than one field where none of the fields are arrays An index on more than one field where multiple fields are arrays верно

An index where one of the indexed fields contains an array

What will the following command return? (Select one.) db.customers.aggregate([{ $indexStats: {} }]); A. An array of integers, each one representing the score assigned to each index in the collection. B. An array of documents, each representing an index specification document. C. An object estimating how much has been saved by leveraging the existing indexes to support queries against the collection. D. Suggested actions that can be taken on current mongod instances to improve performance. Specifically, suggestions to create indexes that can support common usage patterns.

B. An array of documents, each representing an index specification document.

You have a collection that contains zip codes in the United States. Here's a sample document from this collection: _id: ObjectId('5c8eccc1caa187d17ca6eea2') city: "EVERGREEN" zip: "36401" loc: Object y: 31.458009 x: 86.925771 pop: 8556 state: "AL" What will the output of this aggregation pipeline be? (Select one.) db.zips.aggregate([ { $match: { "state": "CA" } }, { $group: { "_id": "$zip" } } ]) A. One document for each city located in California (CA) B. One document for each zip code located in California (CA) C. The total number of documents that contain a zip code in the state of California (CA) D. All documents that contain a zip where the state is California (CA)

B. One document for each zip code located in California (CA)

Given the following index: db.collection.createIndex({ stock: 1 }, { sparse: true }) Which document will be indexed? (Select one.) A. { sku: 131, product_name: "Milk", price: 3, } B. { sku: 121, product_name: "Bread", price: 2, stock: 50 } A. Option A B. Option B

B. Option B

Which index would most effectively support the following query? (Select one.) db.collection.find({ timestamp: { $gte: ISODate("2021-05-18T00:00:00.000Z"), $lt: ISODate("2021-05-19T00:00:00.000Z") }, username: "j0hnny"}).sort({ rating: 1}) A. db.collection.createIndex({ timestamp: 1, username: 1, rating: 1 }) B. db.collection.createIndex({ username: 1, rating: 1, timestamp: 1 }) C. db.collection.createIndex({ rating: 1, timestamp: 1, username: 1 }) D. db.collection.createIndex({ rating: 1, username: 1, timestamp: 1 }) Incorrect Answer A. Option A B. Option B C. Option C D. Option D

B. Option B

3. How does MongoDB support encryption at rest? By using SSL/TLS By using AES-256 encryption By using SHA-256 encryption By using RSA encryption

By using AES-256 encryption

6. How does MongoDB support network encryption? By using SSL/TLS By using AES-256 encryption By using SHA-256 encryption By using RSA encryption верно

By using SSL/TLS

8. What is the process of creating a user in MongoDB native authentication? By using LDAP By using x.509 certificates By using username and password By using Kerberos верно

By using username and password

Here's a sample document from this collection: _id: ObjectId('5c8eccc1caa187d17ca6eea2') city: "EVERGREEN" zip: "36401" loc: Object y: 31.458009 x: 86.925771 pop: 8556 state: "AL" What will the output of this aggregation pipeline be? (Select one.) db.zips.aggregate([ { $group: { "_id": "$pop" } }, { $sort: { _id: -1 } }, { $limit: { 10 } } ]) A. All documents, each containing the population of a zip code as the _id, sorted by population in ascending order B. All documents, each containing the population of a zip code as the _id, sorted by population in descending order C. 10 documents, each containing the population of a zip code as the _id, sorted by population in descending order D. 10 documents, each containing the population of a zip code as the _id, sorted by population in ascending order

C. 10 documents, each containing the population of a zip code as the _id, sorted by population in descending order

What are the advantages of providing a metaField field when creating a time series collection? (Select one.) Example: db.createCollection("stockprice", { timeseries: { timeField: "timestamp", metaField: "metadata", granularity: "seconds", }, }); A. Improves the efficiency of querying data that changes over time B. Allows you to visualize the data using third party tools C. Allows for better organization by attaching additional information directly to the data

C. Allows for better organization by attaching additional information directly to the data

What does the $out stage do? (Select one). A. Removes documents from the aggregation pipeline. B. Returns all the documents currently in the aggregation pipeline as one large document. C. Creates a new collection that contains the documents in this stage of the aggregation pipeline. D. Removes the current user who is running the aggregation pipeline from the database.

C. Creates a new collection that contains the documents in this stage of the aggregation pipeline.

You have a collection that contains zip codes in the United States. Here's a sample document from this collection: _id: ObjectId('5c8eccc1caa187d17ca6eea2') city: "EVERGREEN" zip: "36401" loc: Object y: 31.458009 x: 86.925771 pop: 8556 state: "AL" What will the output of this aggregation pipeline be? (Select one.) db.zips.aggregate([ { $group: { "_id": "$pop" } }, { $sort: { _id: -1 } } ]) A. One document for the population of each zip code, sorted in random order B. 10 documents for the population of each zip code C. One document for the population of each zip code, sorted in descending order D. One document for the population of each zip code, sorted in ascending order

C. One document for the population of each zip code, sorted in descending order

Which of the following statements about sparse indexes are true? (Select all that apply.) A. Sparse indexes only create index entries for documents that have null or non-null values for the indexed field. B. Sparse indexes are used to support queries against documents that meet a specified filter expression. C. Sparse indexes will not be chosen by the query planner if it means the query results will be incomplete. D. Sparse indexes only create index entries for documents that have non-null values for the indexed field.

C. Sparse indexes will not be chosen by the query planner if it means the query results will be incomplete. A. Sparse indexes only create index entries for documents that have null or non-null values for the indexed field.

Why should you use a wildcard index to support queries in a MongoDB collection instead of a regular index? (Select one.) A. Wildcard indexes have a smaller storage footprint than regular indexes. B. Wildcard indexes make queries that use regular expressions more efficient. C. Wildcard indexes can support queries against any field, even if that field is unknown at the time of querying. D. Wildcard indexes allow for efficient querying against time-series data. Incorrect. Wildcard indexes do not offer any advantages for querying against time series data.

C. Wildcard indexes can support queries against any field, even if that field is unknown at the time of querying.

How does a clustered index in MongoDB differ from a regular index? (Select all that apply.) A. Clustered indexes arrange documents in order based on their index key. B. Clustered indexes optimize query performance for a given field over regular indexes. C. Clustered indexes store the index key alongside the documents themselves. D. Clustered index keys eliminate the need for an additional TTL (time to live) index.

Clustered index keys eliminate the need for an additional TTL (time to live) index. C. Clustered indexes store the index key alongside the documents themselves. A. Clustered indexes arrange documents in order based on their index key.

What is the main difference between $set and $project? (Select one.) A. $set changes the values of fields. $project can show and hide fields, but it can't set values of fields. B. $set can only create new fields, and $project can only modify existing fields. C. $project, $set, and $addFields are all interchangable. D. $set is used to create or change values of new or existing fields. $project can be used to create or change the value of fields, but it can also be used to specify which fields to show in the documents in the aggregation pipeline.

D. $set is used to create or change values of new or existing fields. $project can be used to create or change the value of fields, but it can also be used to specify which fields to show in the documents in the aggregation pipeline.

db.customers.createIndex({email:1}, {unique:true}) What would happen if you attempt to insert a new document with an email that already exists in the collection? (Select one.) Correct Answer A. The new document will be inserted and replace the old document in the collection. B. The new document will be inserted and the old document will remain in the collection. C. MongoDB will return a duplicate key error, and the document will be inserted. D. MongoDB will return a duplicate key error, and the document will not be inserted.

D. MongoDB will return a duplicate key error, and the document will not be inserted. Your Answer: Correct Correct. Unique indexes ensure that indexed fields do not store duplicate values. In this example, MongoDB will return a duplicate key error if you attempt to insert a new document with an email that already exists in the collection, as the unique constraint was set to true.

Given the following query: db.people.find({ "metadata.likes": "golfing", "metadata.age": 30 }) Which of the following indexes would support all the fields in the query? (Select one.) A. db.people.createIndex({ name: 1 }) B. db.people.createIndex({ metadata: 1}) C. db.people createIndex({ metadata.likes, metadata.status }) D. db.people.createIndex({ 'metadata.$**': 1 }) A. Option A B. Option B C. Option C D. Option D

D. Option D

Which command performs an aggregation operation by using an aggregation pipeline? (Select one.) A. group() B. filter() C. aggregation() D. aggregate()

D. aggregate()

5. What is the best practice for hardening MongoDB security? Disable JavaScript evaluation Enable network access Disable firewall rules Allow remote connections верно

Disable JavaScript evaluation

10. What is the recommended order of fields in a compound index? (Select one.) Sort, Range, Equality Range, Sort, Equality Equality, Sort, Range The order of indexed fields is not important.

Equality, Sort, Range

10. What is the recommended order of fields in a compound index? (Select one.) Sort, Range, Equality Range, Sort, Equality Equality, Sort, Range The order of indexed fields is not important. верно

Equality, Sort, Range

1. Which of the following statements about indexes are correct? (Select all the that apply.) Indexes are data structures that improve performance, support efficient equality matches and range-based query operations, and can return sorted results. Indexes are automatically created based on usage patterns. Indexes are used to make querying faster for users. One of the easiest ways to improve the performance of a slow query is create indexes on the data that is used most often. When using an index, MongoDB reads every document in a collection to check if it matches the query that's being run.

Indexes are data structures that improve performance, support efficient equality matches and range-based query operations, and can return sorted results. Indexes are used to make querying faster for users. One of the easiest ways to improve the performance of a slow query is create indexes on the data that is used most often.

1. Which of the following statements about indexes are correct? (Select all the that apply.) Indexes are data structures that improve performance, support efficient equality matches and range-based query operations, and can return sorted results. Indexes are automatically created based on usage patterns. Indexes are used to make querying faster for users. One of the easiest ways to improve the performance of a slow query is create indexes on the data that is used most often. When using an index, MongoDB reads every document in a collection to check if it matches the query that's being run.

Indexes are data structures that improve performance, support efficient equality matches and range-based query operations, and can return sorted results. Indexes are used to make querying faster for users. One of the easiest ways to improve the performance of a slow query is create indexes on the data that is used most often.

2. Which of the following statements about indexes are true? (Select one.) Indexes improve query performance and have no impact on write performance. Indexes improve query performance at the cost of write performance. Indexes have no impact on query performance but improve write performance. Indexes have a negative impact on query performance but improve write performance

Indexes improve query performance at the cost of write performance.

2. Which of the following statements about indexes are true? (Select one.) Indexes improve query performance and have no impact on write performance. Indexes improve query performance at the cost of write performance. Indexes have no impact on query performance but improve write performance. Indexes have a negative impact on query performance but improve write performance.

Indexes improve query performance at the cost of write performance.

11. What are the ramifications of deleting an index that is supporting a query? (Select one.) The performance of the query will improve. The performance of the query will be negatively affected. The query will fail. The query will perform as expected.

The performance of the query will be negatively affected.

5. What of the following statements regarding the 𝑢𝑝𝑑𝑎𝑡𝑒𝑀𝑎𝑛𝑦() method for the MongoDB Shell (𝑚𝑜𝑛𝑔𝑜𝑠ℎ) are true? (Select one.) This method is used to rebuild the indexes on a collection. This method is used to update the first document that matches a filter document. This method accepts a filter document, an update document, and an optional options document. This method is used exclusively for updating documents within a transaction.

This method accepts a filter document, an update document, and an optional options document.

6. Which of the following statements regarding the ∂𝑒𝑡𝑒𝑀𝑎𝑛𝑦() MongoDB Shell (𝑚𝑜𝑛𝑔𝑜𝑠ℎ) method are correct? (Select all that apply.) This method is used to delete the first document that matches a filter document. This method can be used to delete all documents in a collection. This method is used to delete multiple collections at once. This method accepts a filter document and an optional options document and is used to delete multiple documents in a collection.

This method can be used to delete all documents in a collection. This method accepts a filter document and an optional options document and is used to delete multiple documents in a collection.

3. Which of the following statements about the 𝑓∈𝑑𝐴𝑛𝑑𝑀𝑜𝑑if𝑦() method are true? (Select all that apply.) This method finds a document and modifies it. This method returns an unmodified document before it's updated. This method, by default, returns the updated document after it has been updated. This method can insert a document if there are no documents that match the query when the 𝑢𝑝𝑠𝑒𝑟𝑡 option is set to 𝑡𝑟𝑢𝑒 in the options document. верно

This method finds a document and modifies it. This method returns an unmodified document before it's updated. This method can insert a document if there are no documents that match the query when the 𝑢𝑝𝑠𝑒𝑟𝑡 option is set to 𝑡𝑟𝑢𝑒 in the options document. верно

1. Which of the following statements regarding the 𝑟𝑒𝑝𝑙𝑎𝑐𝑒𝑂≠() method for the MongoDB Shell (𝑚𝑜𝑛𝑔𝑜𝑠ℎ) are true? (Select all that apply.) This method is used to replace a single document that matches the filter document. This method accepts a filter document, a replacement document, and an optional options document. This method can replace multiple documents in a collection. This method returns a document containing an acknowledgement of the operation, a matched count, modified count, and an upserted ID (if applicable). верно

This method is used to replace a single document that matches the filter document. This method accepts a filter document, a replacement document, and an optional options document. This method returns a document containing an acknowledgement of the operation, a matched count, modified count, and an upserted ID (if applicable).

9. What is the role of a firewall in MongoDB security? To encrypt data To restrict network access to the database To monitor database activity To allow remote connections

To restrict network access to the database

10. What is the purpose of the $unwind stage in MongoDB aggregation framework? To join data from multiple collections To decompose an array into separate documents To store data in a flat file To convert data into a graph

To decompose an array into separate documents

10. What is the significance of security best practices in MongoDB? To ensure data availability To provide fine-grained control over user access To enhance security To monitor database activity

To enhance security

4. What is the purpose of the $match stage in MongoDB aggregation framework? To filter documents based on a specified condition To summarize data from multiple documents To group data based on a specified expression To rearrange documents based on a specified expression

To filter documents based on a specified condition

1. What is the purpose of the MongoDB aggregation framework? To group and summarize data from multiple documents To store data in a flat file To process data in real-time To convert data into a graph

To group and summarize data from multiple documents

5. What is the purpose of the $group stage in MongoDB aggregation framework? To filter documents based on a specified condition To summarize data from multiple documents To group data based on a specified expression To rearrange documents based on a specified expression

To group data based on a specified expression

9. What is the purpose of the $lookup stage in MongoDB aggregation framework? To join data from multiple collections To group and summarize data from multiple documents To store data in a flat file To convert data into a graph

To join data from multiple collections

4. What is the purpose of auditing in MongoDB? To encrypt data To monitor database activity To back up data To restrict access to specific users

To monitor database activity

7. What is the purpose of custom roles in MongoDB authorization? To restrict access to specific users To monitor database activity To provide fine-grained control over user access To encrypt data

To provide fine-grained control over user access

6. What is the purpose of the $project stage in MongoDB aggregation framework? To filter documents based on a specified condition To summarize data from multiple documents To group data based on a specified expression To reshape documents by adding, removing, or modifying fields

To reshape documents by adding, removing, or modifying fields

1. What is the purpose of authentication in MongoDB? To restrict access to specific users To encrypt data To back up data To monitor database activity

To restrict access to specific users

9. Which of the following describes how the .sort() method is used? (Select one.) To return a cursor that points to the documents that match a query. To specify the fields to sort by and the direction of the sort: 1 for ascending or -1 for descending. To specify the maximum number of results that we want to return. To find one document in a collection.

To specify the fields to sort by and the direction of the sort: 1 for ascending or -1 for descending.

8. Which of the following describes how the .limit() method is used? (Select one.) To return a cursor that points to the documents that match a query. To specify the maximum number of results that we want to return. To sort query results in either ascending or descending order. верно

To specify the maximum number of results that we want to return.

10. The $unset operator deletes a particular field: { $unset: { <field1>: "", ... } }. The specified value in the $unset expression (i.e. "") does not impact the operation. True False верно

True

2. In mongosh, when you assign the cursor returned from the find() method to a variable using the var keyword, the cursor does not automatically iterate. True False

True

2. Replacing a document in MongoDB will keep the original document's _ field. True False

True

3. MongoDB creates a single field index on the _id field by default, but additional indexes may be needed for other fields as well. A single field index can also be a multikey index if it operates on an array field. True False верно

True

4. When the ≠𝑤 option is set to 𝑡𝑟𝑢𝑒, 𝑓∈𝑑𝐴𝑛𝑑𝑀𝑜𝑑if𝑦() returns the updated document. True False верно

True

5. A multikey index is an index on an array field. Each element in the array gets an index key, which supports efficient querying against array fields. Both single field and compound indexes can have an array field, so there are both multikey single field indexes and multikey compound indexes. True False

True

7. After deleting a document, the MongoDB Shell will return a document that contains two properties: 𝑎𝑐𝑘𝑛𝑜𝑤≤𝑑≥𝑑, which is set to a boolean, and ∂𝑒𝑡𝑒𝑑𝐶𝑜𝑢𝑛𝑡, which is set to a number. True False верно

True

8. A compound index is created by specifying the fields that the index should reference, followed by the order in which the fields should be sorted. The order of the fields in the index is important because it determines the order in which the documents are returned when querying the collection. A compound index can also be a multikey index if one of the fields is an array. True False

True

8. A compound index is created by specifying the fields that the index should reference, followed by the order in which the fields should be sorted. The order of the fields in the index is important because it determines the order in which the documents are returned when querying the collection. A compound index can also be a multikey index if one of the fields is an array. True False верно

True

10. Which of the following statements are true about a projection document? (Select all that apply.) We can include fields in our results by setting their values to 1 in the projection document. We can exclude fields from our results by setting their values to 0 in the projection document. We can either include or exclude fields in the results, but not both. The _id field is the exception to this rule. Inclusion and exclusion statements can be combined in a projection document. верно

We can include fields in our results by setting their values to 1 in the projection document. We can exclude fields from our results by setting their values to 0 in the projection document. We can either include or exclude fields in the results, but not both. The _id field is the exception to this rule.

1. How to iterate cursor up to 20 times and print the matching documents? (Select all that apply.) You can call the cursor variable in the shell like var myCursor = db.collectionname.find(); You can set the DBQuery.shellBatchSize attribute to change the number of documents from the default value; You can just use db.collectionname.findOne() method; You can't iterate cursor more than 20 times

You can call the cursor variable in the shell like var myCursor = db.collectionname.find(); You can set the DBQuery.shellBatchSize attribute to change the number of documents from the default value;

9. What method appends element to the array if this element doesn't exist already? $pop $pull $addToSet $pullAll $set() верно

addToSet

5. What does iterate the cursor to apply a JavaScript function to each document from the cursor? (Select one) db.collection.find() cursor.toArray() cursor.next() cursor.hasNext() cursor.forEach() верно

cursor.forEach()

4. What does return TRUE if the cursor returned by the db.collection.find() query can iterate further to return more documents? (Select one) db.collection.find() cursor.toArray() cursor.next() cursor.hasNext() cursor.forEach() верно

cursor.hasNext()

3. How to get next document in the cursor returned by the db.collection.find() method. (Select one) cursor.toArray() db.collection.find() cursor.next() cursor.hasNext() cursor.forEach() верно

cursor.next()

7. What method does instruct the server to avoid closing a cursor automatically after a period of inactivity? (Select one) cursor.noCursorTimeout() cursor.objsLeftInBatch() cursor.pretty() cursor.readConcern() cursor.readPref() верно

cursor.noCursorTimeout()

6. What method does return an array that contains all the documents from a cursor? (Select one) db.collection.find() cursor.toArray() cursor.hasNext() cursor.forEach() cursor.readConcern()

cursor.toArray()

8. What methods deletes collection with all documents and indexes? (Select all that apply.) db.< collection >.drop() db.dropDatabase() db.deleteOne(< query >) db.< database >.remove(< query >) db.< indexname >.remove(< query >) верно

db.< collection >.drop() db.dropDatabase()

2. What are the built-in roles in MongoDB for authorization? user, admin, reader, writer read, write, execute, delete dbAdmin, dbOwner, read, readWrite admin, backup, monitor, user верно

dbAdmin, dbOwner, read, readWrite

12. What command is used to hide an index? (Select one.) dropIndex() dropIndexes() getIndexes() hideIndex()

hideIndex()

12. What command is used to hide an index? (Select one.) dropIndex() dropIndexes() getIndexes() hideIndex() верно

hideIndex()


संबंधित स्टडी सेट्स

Activity 5.1 Introduction to the Distribution of Sample Means

View Set

macroeconomics final exam review

View Set

Principles of Marketing Chapter 5

View Set

CM 4222 Kimberley Williams Module 2

View Set

Human Disease: Chapter 7 Fill In The Blank

View Set

Exam 4: Acute Kidney Injury NCLEX Questions

View Set