Is there a way to restrict which fields are sent in the response at a model level. Assume I have the following schema:
var mySchema = new.mongoose.Schema({
public_field1: String,
public_field2: String,
private_field1: String,
private_field1: String,
})
Let's say I want to get all those fields back when I do my query because the private fields are used for some processing, but I only want to send the public fields to the final response. What is the best way to handle that without having to specify it every single route function?