Within the following instance we outline template
attribute to be of sort String
with values outlined within the enum
array:
const noteSchema = new Schema({
title: {sort:String, required: true},
sort: {sort:String, required: true, default: 'be aware'},
content material: String,
reference: String,
tags: [String],
template: {sort:String, enum: ['note', 'checklist']},
userId: {sort: String, ref:'Person'},
__v: { sort: Quantity, choose: false}
},
{
timestamps: true
});
Shared with ā¤ļø from Codever. Use š copy to mine performance so as to add it to your private snippets assortment.
Codever is open supply on Githubāš