updating nested array

52 views
Skip to first unread message

Sandeep Nair

unread,
Aug 13, 2020, 6:07:51 AM8/13/20
to Mongoose Node.JS ODM
Hey folks. this is my schema
const socialSchema = new mongoose.Schema({
    Entry_Number: Number,
    Player_Name: String,
    Player_Message : String,
    Player_Fullmessage: String,
    Player_ProfilePic : String,
    Player_UploadedPic: String,
    Player_UploadedVideos: String,
    Status_Date: String,
    Status_Feeling: String,
    Google_Profile: String,
    Status_Likes: [{Like_Number: Number, Liked_By: String}],
    Status_Comments: [{
                        Comment_Number: Number,
                        Comment_By: String,
                        Comment_Message: String,
                        replies: [
                          {Comment_By: String,
                           Comment_Message: String}
                        ]
                     }],
    Friends: { type: Array, default: []},
    Shares: { type: Array, default: []},
    Shared_Post: String,
    Shared_Newmessage: String,
    Shared_PostDetails: [{type: Schema.Types.ObjectId, ref: "socialdatas"}]
});

how do i update the replies array within the Status_Comments array. Can some one pelase throw some light
Reply all
Reply to author
Forward
0 new messages