is there a way to define a Model in mongoose that does not have the .save() method? is there a way to define a Model in mongoose that does not have the .save() method? mongoose mongoose

is there a way to define a Model in mongoose that does not have the .save() method?


Why would you do schedule.save() anyway? You are supposed to save the parent object (i.e. Student object), not embedded document. If you save schedule then the _id will be appended by default. This won't happen if you save Student object with schedule as an embedded document.

Also there is no real reason for disabling .save method on your Schedule model (this is an interesting feature that allows you to have Schedule model as a model for embedded documents and a model for stand-alone documents at the same time). Just don't use it. Do something like this:

var student = new Student({ firstName: 'John' });var schedule = new Schedule({ day: 3, time: 15 });student.schedules.push( schedule );student.save( );