Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 483 Bytes

File metadata and controls

13 lines (10 loc) · 483 Bytes

Advanced Schemas

Creating from ES6 Classes Using loadClass()

Mongoose allows creating schemas from ES6 classes. The loadClass() function lets you pull in methods, statics, and virtuals from an ES6 class. A class method maps to a schema method, a static method maps to a schema static, and getters/setters map to virtuals.

[require:Creating from ES6 Classes Using `loadClass\(\)`]