using spread syntax with Mongoose Document after calling the .save method results in undefined keys using spread syntax with Mongoose Document after calling the .save method results in undefined keys mongoose mongoose

using spread syntax with Mongoose Document after calling the .save method results in undefined keys


This is because Mongoose uses getters for all of its attributes. Before you use the spread operator, call createdNpc.toObject() to get a normal Object.