Open Shubham-Kumar-2000 opened 1 year ago
Suppose there is following collection :
const mongoose = require('mongoose'); const Schema = mongoose.Schema; const imageSchema = new Schema( { key: { type: String }, filePath: { type: String, default: '' } }, { timestamps: true } ); imageSchema.pre('save', function (next) { const data = this; data.filePath = 'abc.com' + data.key; return next(); }); const Image = mongoose.model('Images', imageSchema); module.exports = Image;
As you can see her fields like filePath, createdAt and updatedAt are auto generated field and shouldn't come in UI
filePath
createdAt
updatedAt
Suppose there is following collection :
As you can see her fields like
filePath
,createdAt
andupdatedAt
are auto generated field and shouldn't come in UI