C100DEV practice questions, page 3 of 4, with answer review and explanations.
Question 11
Given the following documents in a collection and given a unique index on the n field:{ _id: 1, n: ‘Apple’, p: 0.75, c: ‘Green’ },{ _id: 2, n: ‘Orange’, p: 0.85, c: ‘Orange’, q: 14 },{ _id: 3, n: [1,3,5,7], c: 42 },{ _id: 9, n: Green, c: 42 }What document can successfully be added in the same collection?
Given the following explain plan:What statement is true for this explain plan?
This is using an index.
This has a sort stage with index support.
This is not using an index.
This uses an index in reverse direction.
Question 13
Given the following documents in the orders collection:What mongosh command will find a document with status order placed?
db.orders.find_one( {status:“Order Placed”} )
db.orders.findOne( {status:“Order Placed”} )
db.orders.findone( {status:“Order Placed”} )
db.orders.find_One( {status:“Order Placed”} )
Question 14
A collection named products contains 100 documents.What method should be used to get all results from a cursor using mongosh?
db.products.findAll();
db.products.forEach().toArray();
db.products.find().toArray();
db.products.find()[];
Question 15
Given the following schema sample in the inventory collection (with 1 million documents):{ “_id” : 1, “item” : “Apple”, “type” : “fruit”, “quantity” : 500 }What operations may become slower if the index {“item”: 1, “quantity”: 1} is created on this collection?