C100DBA

C100DBA practice questions, page 5 of 6, with answer review and explanations.

Question 21

Which two statements are true about the Java driver? (Choose two.)

  1. The driver uses JMX to allow for monitoring.
  2. The driver’s first authentication mechanism preference is PLAIN.
  3. The driver can be setup via Maven or Gradle.
  4. The driver automatically sets Read Preference to “primaryPreferred”.

Question 22

A collection has the following documents:{_id: 1, lastName: “Doe”, hobbies: “likes sports, reading, and bird watching“}{_id: 2, lastName: “Spears”, hobbies: “likes to ride a bike and hiking“}{_id: 3, lastName: “Smith”, hobbies: “likes to watch movies and medieval spears“}A text search query follow the pattern “find all people where ‘spears’ appears in any data field”. The appropriate analyzer has been selected to support this query.What Atlas Search index should be created?

  1. { “mappings”: {“dynamic”: yes}}
  2. { “mappings”: {“dynamic”: true}}
  3. { “mappings”: {“dynamic”: 1}}
  4. { “mappings”: {“dynamic”: “runtime}}

Question 23

Given the following sample documents in the inventory collection:{ _id: 6305, name: “A. S.”, “assignment” : 5, “status” : “A” },{ _id: 6308, name: “B. M.”, “assignment” : 3, “status” : “B” },{ _id: 6312, name: “E. M.”, “assignment” : 5, “status” : “C” },{ _id: 6319, name: “R. S.”, “assignment” : 2, “status” : “D” },{ _id: 6322, name: “A. S.”, “assignment” : 2, “status” : “A” },{ _id: 6234, name: “R. S.”, “assignment” : 1, “status” : “B” },{ _id: 6235, name: “A. S.”, “assignment” : 1, “status” : “C” },{ _id: 6315, name: “E. M.”, “assignment” : 3, “status” : “A” },What expression will remove only one document with “status”: ”A” in the inventory collection?

  1. db.inventory.deleteMany ({“status”: “A”})
  2. db.inventory.deleteOne ({“status”: “A”})
  3. db.inventory.insertOne ({“status”: “A”})
  4. db.inventory.remove ({“status”: “A”})

Question 24

What syntax connects to a MongoDB Atlas cluster via the Java Driver using the DNS seed list connection format?

  1. ConnectionString connectionString = new ConnectionString(“mongodb+srv://_mongodb._tcp.cluster0.myorg.mongodb.net/test?retryWrites=true&w=majority”);
  2. ConnectionString connectionString = new ConnectionString(“mongodb://_mongodb._tcp.cluster0.myorg.mongodb.net/test?retryWrites=true&w=majority”);
  3. ConnectionString connectionString = new ConnectionString(“mongodb+srv://cluster0.myorg.mongodb.net/test?retryWrites=true&w=majority”);
  4. ConnectionString connectionString = new ConnectionString(“mongodb://cluster0.myorg.mongodb.net/test?retryWrites=true&w=majority”);

Question 25

Given the following sample documents in the incidents collection:{ _id: 232, ts: ISODate(“2022-05-20T12:02:00Z”), component: “ABC”, status: “Closed” },{ _id: 153, ts: ISODate(“2022-05-22T10:20:00Z”), component: “ABC”, status: “In Progress” },{ _id: 353, ts: ISODate(“2022-05-24T22:09:00Z”), component: “XYZ”, status: “Opened” },{ _id: 464, ts: ISODate(“2022-05-24T09:12:00Z”), component: “XYZ”, status: “Opened” },{ _id: 212, ts: ISODate(“2022-05-24T12:23:00Z”), component: “XYZ”, status: “Closed” },{ _id: 484, ts: ISODate(“2022-05-24T20:46:00Z”), component: “ABC”, status: “In Progress” },What command updates only the earliest opened incident, changes its status to “In Progress”, and returns the original document?

  1. db.incidents.updateOne({ “status” : “Opened” }, { $set : { status : “ In Progress” } }, { sort : { “ts” : 1 } })
  2. db.incidents.updateOne({ “status” : “Opened” }, { $set : { status : “ In Progress” } }, { sort : { “ts” : -1 } })
  3. db.incidents.findOneAndUpdate({ “status” : “Opened” }, { $set : { status : “ In Progress” } }, { sort : { “ts” : 1 } })
  4. db.incidents. findOneAndUpdate({ “status” : “Opened” }, { $set : { status : “ In Progress” } }, { sort : { “ts” : -1 } })