Why does Mongoose insert null as the last element of the subdocuments array? Why does Mongoose insert null as the last element of the subdocuments array? mongoose mongoose

Why does Mongoose insert null as the last element of the subdocuments array?


replace for loop with forEach

req.body.cards.forEach(item=>{userCards.cards.push(item)})