How to Get Schema Object From a Mongoose Model?

You can get the Mongoose schema object from a Mongoose model simply by accessing the schema property on it, for example, like so:

import { model } from 'mongoose';

const schema = model('name_of_model').schema;

Hope you found this post useful. It was published . Please show your love and support by sharing this post.