Select all true statements about the $merge stage.
A collection called players contains the following documents:
[ { _id: 1, user: 'Tom', scores: [ 23, 56, 3, 52, 62 ], bonus: 5 }, { _id: 2, user: 'Jane', scores: [ 42, 50, 10 ], bonus: 3 } ]
You want to add additional fields to each document:
-> total_score (sum of the scores Array) -> avg_score (average score in scores Array) -> total_score_with_bonus (total_score + bonus) Expected output: [ { _id: 1, user: 'Tom', scores: [ 23, 56, 3, 52, 62 ], bonus: 5, total_score: 196, avg_score: 39.2, total_score_with_bonus: 201 }, { _id: 2, user: 'Jane', scores: [ 42, 50, 10 ], bonus: 3, total_score: 102, avg_score: 34, total_score_with_bonus: 105 } ]
Which query do you need to use?
In your database there is a movies collection with the following document structure: { _id: ObjectId("573a1390f29313caabcd42e8"), genres: [ 'Short', 'Western' ], title: 'The Great Train Robbery', rated: 'TV-G', year: 1903, imdb: { rating: 7.4, votes: 9847, id: 439 }, countries: [ 'USA' ] }, { _id: ObjectId("573a1390f29313caabcd4323"), genres: [ 'Short', 'Drama', 'Fantasy' ], rated: 'UNRATED', title: 'The Land Beyond the Sunset', year: 1912, imdb: { rating: 7.1, votes: 448, id: 488 }, countries: [ 'USA' ] } In some documents, where there is no rating information for movie, the value is set to '' (empty string). With that in mind, which of the following queries will return the title and rating (see below) of top 3 rated movies in this collection?
A social media company needs to implement a data model that describes te relationships between users. When loading real data into the system, it turned out that one user has too many contacts to store them in the designated array. Instead of redesigning the entire system what pattern can you use?
Suppose you added the following index to a products collection: { product_category: 1 } Which of the following operations can potentially decrease performance?