ネストされたドキュメントを 1 つだけではなく、すべて削除しようとしています。
コードは次のとおりです。
//find and remove all of the embedded workorder units
db.workorders.find({units: { $ne: null } }, function(err, wos) {
console.log(wos);
console.log("removing the embedded workorder units");
_.each(wos, function(wo) {
wo.units.remove();
});
setTimeout(function() { next() }, 2000);
});