I am trying to create a model for a collection whose objects look like below,how do declare clonedChangesdetailslist in mongoose which is a list of dictionaries?[String] doesn't seem to be the right thing?
{
"_id" : ObjectId("6d17d2dd84d4734eea82989f"),
"orgChange" : "62369696",
"created_on" : ISODate("2019-06-29T14:06:20.686Z"),
"clonedChangesdetailslist" : [
{
"clonedChange" : "62392779",
"clonedStatus" : "PASS",
"clonedChangeFinalStatus" : "PASS",
"updatedFailedReason" : "N/A",
"clonedChangeFinalStatusReason" : "N/A",
"updateStatus" : "PASS",
"clonedStatusfailReason" : "N/A"
},
{
"clonedChange" : "62392793",
"clonedStatus" : "PASS",
"clonedChangeFinalStatus" : "PASS",
"updatedFailedReason" : "N/A",
"clonedChangeFinalStatusReason" : "N/A",
"updateStatus" : "PASS",
"clonedStatusfailReason" : "N/A"
}
]
}
mongodb model
const mongoose = require('mongoose');
const { Schema } = require('mongoose');
const change_cloning_Schema= new Schema({
orgChange: String,
created_on: String,
clonedChangesdetailslist:[String]
},
{
collection: 'change_cloning',
timestamps: { createdAt: true, updatedAt: true },
});
module.exports = mongoose.model('change_cloning', change_cloning_Schema);