Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to can we remove auto generated fields from the UI #108

Open
Shubham-Kumar-2000 opened this issue Sep 21, 2023 · 0 comments
Open

How to can we remove auto generated fields from the UI #108

Shubham-Kumar-2000 opened this issue Sep 21, 2023 · 0 comments

Comments

@Shubham-Kumar-2000
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant