Question 61

What is the best practice in using the $match operator?
  • Question 62

    We have a movies collection with the following document structure: { _id: ObjectId("573a1390f29313caabcd6223"), genres: [ 'Comedy', 'Drama', 'Family' ], title: 'The Poor Little Rich Girl', released: ISODate("1917-03-05T00:00:00.000Z"), year: 1917, imdb: { rating: 6.9, votes: 884, id: 8443 } } We need to use Aggregation Framework to fetch all movies from this collection where 'Drama' is not in genres list and the minimum 'imdb.votes' is at least 100. Additionally, in the projection stage, we want to leave only the following fields: -> title -> genres -> imdb.votes We also want to sort the result set by decreasing imdb votes and limit the number of documents retuned to 5. Example output: [ { imdb: { votes: 1294646 }, genres: [ 'Action', 'Mystery', 'Sci-Fi' ], title: 'Inception' }, { imdb: { votes: 1109724 }, genres: [ 'Adventure', 'Fantasy' ], title: 'The Lord of the Rings: The Fellowship of the Ring' }, { imdb: { votes: 1081144 }, genres: [ 'Adventure', 'Fantasy' ], title: 'The Lord of the Rings: The Return of the King' }, { imdb: { votes: 1080566 }, genres: [ 'Action', 'Sci-Fi' ], title: 'The Matrix' }, { imdb: { votes: 1004805 }, genres: [ 'Action', 'Thriller' ], title: 'The Dark Knight Rises' } ] Which pipeline should you use?
  • Question 63

    You have a configuration file for mongod instance called mongod.conf in your working directory. How can you launch mongod instance with this configuration file?
  • Question 64

    You have to launch a replica set with three members. For the first node you have the following mongo1.conf configuration file: storage: dbPath: /var/mongodb/db/1 net: bindIp: localhost port: 27000 security: authorization: enabled systemLog: destination: file path: /var/mongodb/logs/mongod1.log logAppend: true processManagement: fork: true Update this configuration file so that this mongod instance: -> authenticates internally using the keyfile /var/mongodb/pki/keyfile -> belongs to the replica set repl-set-1 Which of the following configuration file should you choose?
  • Question 65

    Which of the following commands will successfully insert exactly two new documents into an empty companies collection?