Is it possible to create a Mongoose hook to apply a projection to all queries

Viewed 441

I'd like to prevent a user's encrypted password from getting sent over the wire each time a user requests their information. I know that in mongo I can apply a projection to achieve this

db.users.findByID(_id, { password: 0 } )

but I would prefer to have some sort of .pre() hook to that will apply it to every query. Is this or a functional equivalent possible?

1 Answers
Related