I have 2 cycles. The first one is for sorting posts. And the second one is to sort through the comments under these posts.
Post.find().then(post =>{
for(let i=0; i<post.length; i++){
for(let ic=0; ic<post[i].comments.length; ic++){
if(post[i].comments[ic].user.secret_id == req.session.secret_id){
post[i].comments[ic].user.user_id = req.body.id;
}
}
}
post.save()
})
It's doesn't work
TypeError: post.save is not a function