Who is doing this to me *sobs*, mongoose or MongoDB? 😥😥

I'm adding new records (array) to an embedded document, but the first record to be added gets duplicated, even with the same ID and stuff :(..

Was using Callbacks, switched to promises, still the same.


  • 2
    Mongoose most likely,

    Can you share code snippet + screenshot? :D
  • 1
  • 2
    Mm, I'm not quite sure why you would need markmodified in this example

    If you push to the array, and your array is on a customer and you do .save, it will also save the array.

    The only time you should do markmodified is if you are editting indexes, like foo[0] = bar.
  • 1
    @D--M True, was just troubleshooting. It behaves the same without the markModify()... Stripping off now. Thanks
Add Comment