How to exclude one particular field from a collection in Mongoose?

Use query.select for field selection in the current (3.x) Mongoose builds.

Prefix a field name you want to exclude with a -; so in your case:

Query.select('-Image');

Quick aside: in JavaScript, variables starting with a capital letter should be reserved for constructor functions. So consider renaming Query as query in your code.


I don't know where you read about that .exclude function, because I can't find it in any documentation.

But you can exclude fields by using the second parameter of the find method.

Here is an example from the official documentation:

db.inventory.find( { type: 'food' }, { type:0 } )

This operation returns all documents where the value of the type field is food, but does not include the type field in the output.


Model.findOne({ _id: Your Id}, { password: 0, name: 0 }, function(err, user){
  // put your code
});

this code worked in my project. Thanks!! have a nice day.