As per the aggregation pipeline optimization concepts, if you have a $sort followed by a $match:
Which features of relational database management systems were deliberately omitted in MongoDB and help us to obtain horizontal scalability? Check all that apply.
The Production MongoDB Cluster contains Personally Identifiable Information, such as Name, Demographics, Date of Birth, and Government Identification Number. Due to strict compliance requirements, a database administrator is tasked to ensure a client ' s side encryption.
What feature should the administrator use to meet the requirement?
Which of the following node is used during election in a replication cluster?
Which of the following is true of the mechanics of replication in MongoDB? Check all that apply.
Consider that you have a collection called population which has fields state and city. Which of the following query will calculate the population grouped by state and city?
What stage of the Winning Plan in an Explain Result identifies the Index Key for the query pattern?
What command will successfully start the mongod daemon with all default settings as a background task?
Consider the following document:
> db.c.find()
{ " _id " : 12, b : [ 3, 5, 7, 2, 1, -4, 3, 12 ] }
Which of the following queries on the " c " collection will return only the first five elements of the array in the " b "
field? E.g.,
Document you want returned by your query:
{ " _id " : 12, " b " : [ 3, 5, 7, 2, 1 ] >
What operation updates the value of the unitsInStock field to 25 for a document with a " laptop " product, and inserts a new document if it does not exist?
What command is used to grant a role " customRole1 " to an existing user called " user1 " ?
Consider a clothing collection that contains these documents:
{ " _id " : 1, " item " : " sweater " , " sizes " : [ " XS " , " S " ] }
{ " _id " : 2, " item " : " t-shirt " , " sizes " : [ " S " , " M " , " XL " ] }
{ " _id " : 3, " item " : " vest " , " sizes " : [ " M " , " L " , " XL " , " XXL " ] }
What does the following query return?
db.clothing.find({ " sizes " : " M " })
An employees collection contains documents with fields such as _id, name, age, department, and salary.
A database administrator needs to run a query that will return ONLY the name and age fields for all employees.
Which query meets this requirement?
What read preference should your application use if you want to read from the primary under normal circumstances but allow reads from secondaries when a primary is unavailable?
What method should be used to configure dynamically runtime parameters for the mongod process in MongoDB?
Consider that you have a collection called population which has fields state and city. Which of the following query will calculate the population grouped by state and city?
What command returns all documents in an orders collection where quantity is less than or equal to 1000 and salesRep is not equal to " Anne " ?
To add a new user and enable authentication in MongoDB, which of the following steps need be executed?
Which of the following is a valid Replica Set configuration if you want:
1-Have 3 copies of everything
2- That RS3 is never primary
2- That RSI and RS2 can be primary?
You had to see the different configurations, RS3 could be hidden or priority 0 (But not a referee because we need
3 replicas), while RSI and RS2 could NOT have priority 0 or be hidden or anything like that
In a 4-member RS RSO , RSI, RS2 and RS3 + Referee, RSO (primary) falls after some write operations that have
replicated RSI and RS2 (but NOT RS3), who can get up as the new primary?
The configuration comes and in it we see that RS2 has a hidden: true (or a priority: 0, (I don ' t remember)
Consider an inventory collection that contains these documents:
{ " _id " : 1, " product " : " x-small box " , " colors " : [ " brown " , " black " , " white " ], " qty " : 50 }
{ " _id " : 2, " product " : " small box " , " colors " : [ " brown " , " white " ], " qty " : 60 }
{ " _id " : 3, " product " : " medium box " , " colors " : [ " black " , " grey " , " white " ], " qty " : 45 }
{ " _id " : 4, " product " : " large box " , " colors " : [ " grey " ], " qty " : 50 }
{ " _id " : 5, " product " : " x-large box " , " colors " : [ " grey " , " white " ], " qty " : 10 }
What result set does the following query return?
db.inventory.find({
$or: [
{ " product " : " x-small box " },
{
$and: [
{ " qty " : { $ne: 50 } },
{ " colors " : { $nin: [ " brown " ] } }
]
}
]
})
A collection named products contains the following documents:
{ " _id " : 1, " name " : " Laptop " , " price " : 1500 }
{ " _id " : 2, " name " : " Smartphone " , " price " : 800 }
{ " _id " : 3, " name " : " Tablet " , " price " : 600 }
{ " _id " : 4, " name " : " Monitor " , " price " : 300 }
{ " _id " : 5, " name " : " Headphones " , " price " : 200 }
Given the following query:
db.products.find().sort({ " price " : -1 }).limit(2)
What is the expected output?
Which of the following is incorrect statement about find and findOne operations in MongoDB?
You have the following index on the toys collection:
{
" manufacturer " : 1,
" name " : 1,
" date " : -1
}
Which of the following is able to use the index for the query? Check all that apply.
A collection named scores includes:
[
{ _id: 1, home_score: 6, away_score: [ 5, 7 ] },
{ _id: 2, home_score: [ 8, 6 ], away_score: 9 },
{ _id: 3, home_score: [ 5, 8 ], away_score: [ 9, 6 ] },
{ _id: 4, home_score: 5, away_score: 10 }
]
Given the following index:
db.scores.createIndex( { home_score: 1, away_score: 1 } )
What document will cause the index to fail?
Below is a sample document in a given collection test.
{ a : 5, b : 3, c: 2, d : 1 >
Given a compound index { a: 1, b:l, c:l, d:l}, Which of the below query will not use in-memory sorting? Select
all valid.
Consider a collection posts which has fields: Jd, post_text, post_author, post_timestamp, post_tags etc. Which of the following query retrieves ONLY the key named post_text from the first document retrieved?
You are comparing values of different BSON types in mongodb. You want to compare from lowest to highest. Which comparison order is used?
What command should a MongoDB database administrator use to find the disk utilization of the order collection?
Write the command(s) are correct to enable sharding on a database " testdb " and shard a collection " testCollection " with _id as shard key.
Consider that the posts collection contains an array called ratings which contains ratings given to the post by various users in the following format:
Which of the following query will return all the documents where the ratings array contains elements that in some combination satisfy the query conditions?
A department store maintains a clothing collection:
{ " _id " : 1, " item " : " sweater " , " sizes " : [ " XS " , " S " , " L " ] }
{ " _id " : 2, " item " : " t-shirt " , " sizes " : [ " S " , " M " , " L " ] }
{ " _id " : 3, " item " : " vest " , " sizes " : [ " M " , " L " , " XL " , " XXL " ] }
An employee runs:
db.clothing.find( { " sizes " : " M " } )
Which index should improve performance for this query the MOST?
What " stage " indicates that no indexes were available for a query pattern?
What is the on-premise solution having functionality equivalent to cloud manager?
Given the following query:
db.load.find({
_id: { $lte: 1000 },
rnd: 1234,
date: { $gte: ISODate( " 2023-01-01 " ) }
}).sort({ date: -1 })
In a compound index that best supports this query, what field should be first field?
What does the following query do when performed on the posts collection? db.posts.update({_id:l},{Title:This is post with ID 1 " })
Which command can be used to rebuild the indexes on a collection in MongoDB?