An idea by @turivishal : create id comment and push it
const commentId = new mongoose.Types.ObjectId()await Post.findByIdAndUpdate(postId, { $push: { comments: { _id: commentId content, }, }, });
It solved my problem. But welcome any other solution