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 } )
The question was posed to me during an online interview.
The origin of the question is Read Operations in division MongoDB CRUD Concepts and Operation of MongoDB