1

is it normal that after I populate a mongoose schema, the result gets console logged to the terminal successfully but doesn't get saved, and instead I get an _id reference to the document that was populated. How can I make sure that the result is saved after population

Opeyemi Odedeyi
  • 766
  • 1
  • 10
  • 38
  • 1
    This is not a book on how population works, but it probably works as a "for dummies" version of a leaflet: [Mongoose populate vs object nesting](https://stackoverflow.com/a/24096822/2313887). Written a while back by myself. – Neil Lunn May 26 '17 at 08:11
  • 1
    Okay, i will check it out. – Opeyemi Odedeyi May 26 '17 at 08:37
  • what are you trying to achieve? The question is quite unclear – ifiok May 26 '17 at 12:40
  • 1
    after I save a mongoose schema to a collection, I want to populate that schema with a parent schema. Example, I have a Car model, and a Person model; and every person has an array of cars. I want to make sure that for each car saved, it gets added to the car array belonging to the right person. Like an owner property relationship. – Opeyemi Odedeyi May 26 '17 at 14:16

0 Answers0