我想为我的meanjs应用程序创建两个不同的用户,即候选人和招聘人员,他们将具有相似且不同的字段,因此,如何扩展用户Schema以避免重复代码。
I highly recommend you to use mongoose discriminators. With discriminator you will have 3 schemas, a user Base schema where you will write all the similar code, and then recruiter and candidate schemas that will implement discriminators key. Here's some info about it:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.