I believe that I saw somebody wrote about a way to fetch the in-memory objects from a model object to reduce DB access. Could some body please advise or share me the document?
I would like to have something like this:
ModelA.create({...}).populate('modelBs').exec(function(err, instanceA) {
// Do some nested things here, for example:
instanceA.prop1 = someNewValue;
instanceA.save(function(err, instanceAModified) {
// I want to call some method from instanceAModified, to get all 'modelB' objects here, without accessing the DB once more.
});
});
Thank you in advance!