I want to create the data model(Schema) in node js according to the the database shown in the picture. How to create the data model of array in node js and also the inside the array which have object, which also contain another array?
const mongoose = require('mongoose');
mongoose.pluralize(null);
const Schema = mongoose.Schema;
const indicatorsSchema = new Schema({
name:String,
metrics:[String] //[String] define array of string
}, { _id: false });
const Learning = new Schema({
learningEvents: String,
learningActivities: [String], //[String] define array of string
indicators:[indicatorsSchema] // define object as above
}, { versionKey: false })
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.