0
我相信我看到有人寫過關於從模型對象中獲取內存中對象以減少數據庫訪問的方法。可以請一些機構建議或分享我的文件?Sailjs /水線 - 有什麼辦法可以獲得先前提取的物體?
我想有這樣的事情:
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.
});
});
預先感謝您!
明白了。非常感謝! – Ducky