Explanation:Projections are the second argument to the find() method,which specify a list of fields to return or list fields to exclude in the result documents. 7. Which of the following query selects documents in the records collection that match the condition { “user_id”: { $lt: 42 } } ?
A. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
B. db.records.find( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
C. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 1 } )
D. db.records.select( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
Answer:A
Explanation:Projections are the second argument to the find() method,which specify a list of fields to return or list fields to exclude in the result documents. 7. Which of the following query selects documents in the records collection that match the condition { “user_id”: { $lt: 42 } } ?
A. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 0 } ) B. db.records.find( { “user_id”: { $lt: 42 } }, { “history”: 0 } ) C. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 1 } ) D. db.records.select( { “user_id”: { $lt: 42 } }, { “history”: 0 } )