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.
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?
A database administrator maintains a MongoDB database that stores scientific papers. A paper with DOI 10.1000/xyz123 is no longer relevant and needs to be removed.
What query should the administrator use to delete the paper with the DOI equal to 10.1000/xyz123?
Which of the following is incorrect statement about find and findOne operations in MongoDB?
Given a replica set with five data-bearing members, suppose the primary goes down with operations in its oplog that have been copied from the primary to only one secondary. Assuming no other problems occur, which of the following describes what is most likely to happen?
Which of the following does MongoDB use to provide High Availability and fault tolerance?
Which option should be used to update all the documents with the specified condition in the MongoDB query?
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 " })
What command set removes node-1.cluster1.mycompany.local:27017 and node-2.cluster1.mycompany.local:27017 from the replica set, then adds node-1.cluster1.mycompany.local:27017 back to the replica set?
Which is the correct order (lowest to highest) in which MongoDB compares the BSON types?
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.
Which of the following is a valid insert statement in mongodb? Select all valid.
In a replica set, which member is responsible for maintaining copies of the primary ' s data?
In a replica set, a_________number of members ensures that the replica set is always able to select a primary.
Suposse tou have the following collection with only 2 documents:
If you run an aggregation query and use { $unwind: " $traits " } as the first stage, how many documents will be passed to the next stage of the aggregation pipeline?
You have a replicated cluster with 1 primary, 3 secondary, 1 arbiter. One of the secondary is hidden. What is the replication factor of this replicated cluster?
Which TWO commands can be used to remove the role, " specialRole " from " user1 " ?
In a replica set with a primary and two secondaries, what should the write concern be set to so only a single node is required to acknowledge a write operation before it is deemed successful?
What does the following $slice query return using the following command? db.posts.find( {}, { comments: { $slice: [ -10, 5 ] } } )
Which of the documents below will be retrieved by the following query? Assume the documents are stored in a collection called " sample " . Check all that apply.
db.sample.find( { " $or " : [ { " a " : { " $in " : [ 3, 10] > }, { " b " : { " $lt " : 2 > > ] > )
In a sharded cluster, from which node does one stop the balancer process before initiating backup?
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 ] >
In a collection that contains 100 post documents, what does the following command do? db. posts. find().skip(5).limit(5)
Which of the following commands will return all the posts with number of likes greater than 100 and less than 200, both inclusive?
What does the following query do when performed on the posts collection? db.posts.update({_id:l},{Title:This is post with ID 1 " })
Given the following MongoDB document in the users collection:
{ " userid " : 1, " first " : " John " , " roles " : " Basic " }
Which statement results in this document?
{ " userid " : 1, " first " : " John " , " roles " : " SuperUser " }
A MongoDB collection named users contains sample documents with fields including name, age, address, description, city, and occupation.
The administrator uses the following query to perform a collection scan:
db.users.find({ city: " New York " , occupation: " Software Engineer " })
What compound index will improve the performance of the query the MOST?
Consider a contacts collection that contains these documents:
{ " _id " : 1, " name " : " Poppy " , " birthday " : " 03-09-1984 " }
{ " _id " : 2, " name " : " Ashley " , " birthday " : " 08-12-1990 " }
{ " _id " : 3, " name " : " Cleo " , " birthday " : " 11-02-1976 " }
What query returns the document where the field name is " Poppy " ?
A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?
Using an arbiter allows one to easily ensure an odd number of voters in replica sets. Why is this important?
What is the output of following two commands in MongoDB: db. posts. insert({n_id " :l}) db.posts.insert({ " _id " :l})
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?
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 " ?
In which of the following scenarios is sharding not the correct option. Select all that apply.