My $push Method In Mongoose Does Not Work Ok
I have a problem understanding why $push creates only one element in nested array and shows only the id of that element  I am talking about timeHistory:[{historySchema}] the rest y
Solution 1:
Looks like you're not using $push correctly. Try passing the correct path to the operator, which in your case is:
Users.findByIdAndUpdate(req.params.id, {
    timeHistory: {
        $push: {
            time: "some text"
        }
    }
})
Here's an example on mongoplayground.
Post a Comment for "My $push Method In Mongoose Does Not Work Ok"