nested objects mongoose express code example
Example: mongoose nested require
var jobSchema = Schema({
negotiation: { state: { type: String, required: hasNegotiation } }
});
function hasNegotiation() {
return this.negotiation && Object.keys(this.negotiation).length > 0;
}