Push items into mongo array via mongoose
Assuming, var friend = { firstName: ‘Harry’, lastName: ‘Potter’ }; There are two options you have: Update the model in-memory, and save (plain javascript array.push): person.friends.push(friend); person.save(done); or PersonModel.update( { _id: person._id }, { $push: { friends: friend } }, done ); I always try and go for the first option when possible, because it’ll … Read more