Custom _id
- 你schema 有 _idmongo 就唔同你gen, 亦唔可以用Schema.ObjectId做ref, 會認唔到type 的
- 可以令 - _id有意思,- e.g. studentSchema, use regnoas custom_id
- e.g. teacherSchema, use teacherInitialas custom_id
 
- e.g. studentSchema, use 
- use - uuidif you need to have- idbefore add new stuff- e.g. attachmentSchema, need the idto rename the attachment before saving to database.
 
- e.g. attachmentSchema, need the 
Schema.ObjectId
- if no need to use custom _idthen use Schema.ObjectId
[{type: string}] vs [String]
In mongoose schema, latter is better as it treat it purely a string array, the former one will create _id for each element.
autoIndex & versionKey
// disable `autoindex` if you know you will not query this schema.
SubjectSchema.set('autoIndex', false);
// disable `versionKey` if you know you don't need to monitor the update.
SubjectSchema.set('versionKey', false);
Use variable as a number
var Teacher = 1;
var Counselor = 2;
var HeadCounselor = 3
var Classmaster = 4
var Headmaster = 5
var Previleged = 6
// ...
role: { type: Int, min: Teacher, max: Previleged}