Does MongoDB offer a find or query method to test if an item exists based on any field value? We just want check existence, not return the full contents of the item.
Im currently using something like this:
async check(query) { const projection = { _id: 1 }; return !!db.collection.findOne(query, projection); }
It will return true or false, of course returning only _id: 1 for smallest data transfer.