Question: Question 1 Consider a collection posts which has fields: _ id , post _ text, post _ author, post _ timestamp, post _ tags etc.
Question Consider a collection posts which has fields: id posttext, postauthor, posttimestamp, posttags etc. Which query retrieves ONLY the key named posttext from the first document retrieved? dbposts.findid: posttext: dbposts.findOneposttext: dbposts.findOneposttext: dbposts.findOneid: posttext: points Question Which of the following is an incorrect statement about find and findOne operations in MongoDB? find returns all the documents in a collection while findOne retrieves only the first one. find and findOne return cursors to the collection documents findOne returns the actual first document retrieved from a collection points Question What does the following MongoDB command return? dbposts.find likes : $gt : $lt : Posts with likes greater than but less than Posts with likes greater than or equal to but less than or equal to Posts with likes less than Will return syntax error points Question Which command finds all documents in the posts collection with a dateinserted field as null? dbposts.finddateinserted: null dbposts.finddateinserted: null dbposts.finddateinserted: isnull points Question What does the following MongoDB command return? dbposts.find likes : $gt : likes : $lt : Posts with likes greater than but less than Posts with likes greater than or equal to but less than or equal to Posts with likes less than Will return syntax error points Question Which command will find all the posts that have a topiccategory as logic. dbposts.find topiccategory : logic dbposts.find topiccategory : logic dbposts.find $array : topiccategory: logic dbposts.findInArray topiccategory : logic points Question Consider that our posts collection contains an array field called tags that contains tags that the user enters. id: tags: tutorial "fun", "learning" posttext: "This is my first post", topiccategory: "lecture" What does the following command return? dbposts.find "tags: "tutorial" All the posts whose tags array contains tutorial All the posts which contains only one tag element in the tag array All the posts having the first element of the tags array as tutorial All the posts which contains or more tags named tutorial points Question Consider that the posts collection contains an array called ratings which contains ratings given to the post by various users in the following format: id: posttext: "This is my first post", ratings: other elements of document Which query will return all the documents where the array ratings contains at least one element between and dbinventory.find ratings: $elemMatch: $gt: $lt: dbinventory.find ratings: ratings: $gt: $lt: dbinventory.find ratings: ratings.$: $gt: $lt: dbinventory.find ratings: $elemMatch: $gte: $lte: points Question Consider that the posts collection contains an array called ratings which contains ratings given to the post by various users in the following format: id: posttext: "This is my first post", ratings: other elements of document Which query will return all the documents where the ratings array contains elements that in some combination satisfy the query conditions? dbinventory.find ratings: $elemMatch: $gt: $lt: dbinventory.find ratings: ratings: $gt: $lt: dbinventory.find ratings: ratings.$: $gt: $lt: dbinventory.find ratings: $elemMatch: $gte: $lte: points Question Consider the following posts document: id: posttext: "This is my first post", author: "Tom", tags: tutorial"quiz","facebook","learning","fun" Which of the following queries will return the documents but with only the first two tags in the tags array? dbposts.findauthor:"Tom"tags:$slice: dbposts.findauthor:"Tom"limittags: dbposts.findauthor:"Tom"limit$slice:tags: Both a and c are valid. $slice works both with projection and limit points Question What is the equivalent command in MongoDB for the following SQL query? SELECT FROM posts WHERE author like john dbposts.find author: john dbposts.find author: $like: john dbposts.find $like: author: john dbposts.find author: john points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
