Introduction to Mongo DB (Week 2 Quiz)|Coursera

Which of the following is true regarding data types in MongoDB?

  1. You should store money using the NumberDecimal (Decimal128) data type.
  2. MongoDB has a special data type called ObjectId for uniquely identifying documents.
  3. MongoDB supports many different data types, but you can’t query documents by type.
  4. By default MongoDB stores all numbers as doubles.

Which of the following is true regarding sort, skip, and limit?

  1. You can same time by using the limitAndSkip method which wraps the limit and skip methods.
  2. Sort accepts two arguments, the sort key and the direction to sort.
  3. The skip method must come before the limit.
  4. You can achieve pagination by using skip and limit together.

Which of the following queries will match this movie document:

{
  "_id": ObjectId("58c59c6a99d4ee0af9e0c32f"),
  "title": "Akrobatisches Potpourri",
  "year": 1895,
  "imdbId": "tt0000011",
  "genre": "Documentary, Short",
  "viewerRating": 5.5,
  "viewerVotes": 111,
  "runtime": 1,
  "director": "Max Skladanowsky",
  "cast": [
    "Grunato"
  ],
  "plot": "Eight circus performers known as the Grunato family perform their famous balancing act."
}
  1. db.movies.find( {“tomatoes.userReviews”: {“$lte” : 2000}} )
  2. db.movies.find( {“viewerRating”: {“$in” : [10, 5.5, 103, 200]}} )
  3. db.movies.find( {“genre”: {“$not” : [“Documentary”, “Short”]}} )
  4. db.movies.find( {“year”: {“$lt” : 1962}} )
  5. db.movies.find( {“year”: {“$lt: 2015, “$gte” : 2000}} )

Given a collection with the following documents:

{
  "arr": [
    { "a": 1, "b": 1 },
    { "a": 2, "b": 2 }
  ]
}

{
  "arr": [
    { "a": 1, "b": 2 },
  ]
}

{
  "arr": [
    { "a": 2, "b": 1 },
    { "a": 1, "b": 2 }
  ]
}

And given this query:

collection.find({"arr.a": 1, "arr.b": 2})

Which of the documents in the collection will be returned by the query above?

  1. Only documents 2 and 3.
  2. Only document 1.
  3. All 3 documents.
  4. None of the documents.

In MongoDB, if we have subdocuments we can …

  1. …reduce the need for database joins.
  2. …express queries using the fields of subdocuments.
  3. …not nest another subdocument inside a subdocument.
  4. …use the subdocuments to store data without limits.

Which of the following commands inserts one document on comments collection?

  1. mflix.comments.update_many({ … }, {“$set”: {“updated”: true}})
  2. mflix.comments.insert_one({ “a”: 1})
  3. mflix.comments.insert_only_one({ “a”: 1 })
  4. mflix.comments.remove({ … })
  5. mflix.comments.insert_one({ “a”: 1 }, false)

Which of the following are update operators?

  1. $set
  2. $inc
  3. $divide
  4. $push
  5. $add

Which of the following statements are true regarding deleting documents in MongoDB?

  1. The remove_many() method lets us delete many documents.
  2. The delete_one() method lets us delete one document.
  3. The remove_one() method lets us delete one document.
  4. The delete_many() method lets us delete many documents.


The content uploaded on this website is for reference purposes only. Please do it yourself first.