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;