Save multiple instances of an embedded document to my model using mongoose Save multiple instances of an embedded document to my model using mongoose mongoose mongoose

Save multiple instances of an embedded document to my model using mongoose


Your schema is correct.My suggesstion is use var keyword instead of const because variable is a data structure that contains information that is expected to change. A constant is a data structure that contains information that will never change. If there is room for error, var should always be used. However, not all information that never changes in the lifetime of a program needs to be declared with const. If under different circumstances the information should change, use var to indicate that, even if the actual change doesn't appear in your code.Try this and see if this works.