I\'m using Mongoose.js to create models with schemas.
I have a list of models (many) and at times I\'d like to get the attributes/keys that make up a particular mo
The accepted answer did not work for me. But using Mongoose 5.4.2 I was able to get the keys by doing the following:
const mySchema = new Schema({ ... }); const arrayOfKeys = Object.keys(mySchema.obj);
I'm using typescript, however. That might have been the problem.