nest mongoose example
Example 1: mongoose nested require
var jobSchema = Schema({
negotiation: { state: { type: String, required: hasNegotiation } }
});
function hasNegotiation() {
return this.negotiation && Object.keys(this.negotiation).length > 0;
}
Example 2: mongoose nestjs
$ npm install --save @nestjs/mongoose mongoose