Question 1

Select all true statements about covered queries.
  • Question 2

    Select all true statements regarding to Aggregation Framework.
  • Question 3

    A collection called players contains documents with the following structure: { _id: 1, user: 'Tom', scores: [ 23, 56, 3, 52, 62 ], bonus: 5 } { _id: 2, user: 'Jane', scores: [ 42, 50, 10 ], bonus: 3 } You have the following query: db.players.aggregate([{ $addFields: { total_score: { $sum: '$scores' }, avg_score: { $avg: '$scores' } } }, { $addFields: { total_score_with_bonus: { $add: ['$total_score', '$bonus'] } } }, { $match: { bonus: { $gt: 4 } } }]) How can you optimize this query?
  • Question 4

    There is a gamers collection in your database with the following document structure:
    { _id: 1, level: 15, is_active: true }, { _id: 2, level: 14, is_active: true }, { _id: 3, level: 7, is_active: false }
    How do you update the value of the level field to 20 for a player with an id = 2?
    Expected result:
    { _id: 1, level: 15, is_active: true }, { _id: 2, level: 20, is_active: true }, { _id: 3, level: 7, is_active: false }
  • Question 5

    Suppose we have a shipwrecks collection with the following document structure: { _id: ObjectId("578f6fa2df35c7fbdbaed8ce"), feature_type: 'Wrecks - Visible', watlev: 'always dry', coordinates: [ -79.9469681, 9.3729954 ] } You ran the command below: db.shipwrecks.getIndexes() And you got the following output: [ { v: 2, key: { _id: 1 }, name: '_id_' }, { v: 2, key: { coordinates: '2dsphere' }, name: 'coordinates_2dsphere', '2dsphereIndexVersion': 3 } ] How can you remove the geospatial index on the coordinates field?