Another way is to use text argument with prefix -
which will exclude this or that field from the result:
Entity.find({ ... }, '-_id field1 field2', function(err, entity) {
console.log(entity); // { field1: '...', field2: '...' }
});
More Related Contents:
- Push items into mongo array via mongoose
- E11000 duplicate key error index in mongodb mongoose
- Why can’t you modify the data returned by a Mongoose Query (ex: findById)
- Mongoose: findOneAndUpdate doesn’t return updated document
- Mongoose populate vs object nesting
- Stop Mongoose from creating _id property for sub-document array items
- Populate nested array in mongoose
- Why does mongoose always add an s to the end of my collection name
- Cannot overwrite model once compiled Mongoose
- mongodb/mongoose findMany – find all documents with IDs listed in array
- MongoError: The ‘cursor’ option is required, except for aggregate with the explain argument
- ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client
- Mongoose Schema hasn’t been registered for model
- Mongoose findByIdAndUpdate not returning correct model
- Mongoose duplicate key error with upsert
- How can I use a cursor.forEach() in MongoDB using Node.js?
- mongoose field with the name type
- Mongoose update without callback
- Uploading images using Node.js, Express, and Mongoose
- Model.find().toArray() claiming to not have .toArray() method
- Mongoose optional search query parameters?
- Difference between MongoDB and Mongoose
- How can I save multiple documents concurrently in Mongoose/Node.js?
- nodejs mongodb object id to string
- How to reference another schema in my Mongoose schema?
- set field as empty for mongo object using mongoose
- Mongoose overwrite the document rather that `$set` fields
- Mongodb $lookup dynamic collection
- Mongoose complex (async) virtuals
- Create unique autoincrement field with mongoose [duplicate]