In a collection that contains 100 post documents, what does the following command do? db. posts. find ().skip(5).limit(5)
A. Skip and limit nullify each other. Hence returning the first five documents.
B. Skips the first five documents and returns the next five
C. Limits the first five documents and then return them in reverse order
D. Skips the first five documents and returns the sixth document five times
Given a collection posts as shown below having a document array comments, which of the following command will create an index on the comment author descending?
A. db.posts.createIndex({commerits.$.author":-l});
B. db.posts.createIndex({comments.$.author": {$desc:l>});
C. db.posts.createIndex({comments.author":-l});
Write the command(s) are correct to enable sharding on a database "testdb" and shard a collection "testCollection" with _id as shard key.
A. sh.enableSharding("testdb") and sh.shardCollection("testdb.testCollection", {_id : 1 }, true )
In a sharded replicas set environment with multiple mongos servers, which of the following would decide the mongos failover?
A. mongos
B. mongo shell
C. individual language drivers
D. mongod
As per the aggregation pipeline optimization concepts, if you have a $sort followed by a $match:
A. Providing these parameters in any order does not impact the performance
B. $sort moves before $match
C. MongoDB does not do any movements by default and will use the order provided
D. $match moves before $sort
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?
A. 3
B. 5
C. 4
D. 2
E. 1
By default, the MongoDB cursor in mongo shell is configured to return how many documents? To get the next set of documents, which command is used?
A. 200, more
B. No limit, none
C. 20, it
D. 50, it
What is the output of following two commands in MongoDB: db. posts. insert({n_id":l}) db.posts.insert ({"_id":l})
A. Two documents will be inserted with _id as 1
B. MongoDB will automatically increment the _id of the second document as 2
C. This will throw a duplicate key error
D. It will insert two documents and throw a warning to the user
What does the following $slice query return using the following command? db.posts.find( {}, { comments: { $slice: [ -10, 5 ] } } )
A. Returns 5 comments, beginning with the last 10 items
B. Returns 10 comments, beginning with the last
C. Returns 10 comments, beginning with the first
D. Returns 5 comments, beginning with the first 10 items
A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?
A. Column and Row
B. Table and Row
C. Database and Table
D. Table and Column