I have a schema in Mongoose that looks like this:
const SocketDetailsUserSchema = new mongoose.Schema({
userId: String,
socketValue: [{
id: String,
data : String
}],
isDeleted: Boolean,
dateCreated: Date,
updateAt: Date
});
I want to insert data of socketValue in key value pair in array format. Which should look like ,
{
"_id" : ObjectId("5a12809c7f7afb1e3626857f"),
"userId" : "59eee19696fe6560cd54a081",
"socketValue" : [{"id":"5a05855b10600e4aa5b3a48e" , "value" : "123" }],[{"id":"5a0ae037a90746c249b6c1f7" , "value" : "456" }],
"isDeleted" : false
"__v" : 0
}
This is the mongoose data format.
How can i insert data in mongoose like this ? I am also confused that how should i post data from postman to insert data in this ?