3
表現不同的這是我做貓鼬選擇,填寫並保存在Mac和Windows
static populateReferralLinks(){
return Promise.coroutine(function*(){
let companies = yield Company.find({},'billing referral current_referral_program')
.populate('billing.user','emails name');
for(let i = 0 ; i < length ; i++){
companies[i].referral.is_created = true;
companies[i].referral.referral_email = companies[i].billing.user.emails[0].email;
companies[i] = yield companies[i].save();
}
return companies;
}).apply(this)
.catch((err) => {
throw err;
});
}
我有我我選擇只有3場有即開票,current_referral_program和轉診去提前功能可按。 並使用billing.user中存儲的引用填充用戶。 現在,當我稱這個功能,然後在線
companies [i] .save();
下面的命令顯示在終端窗口
Mongoose: companies.update(
{ _id: ObjectId("58d12e1a588a96311075c45c") },
{ '$set':
{ billing:
{ configured: false,
user: ObjectId("58d12e16588a96311075c45a") },
referral:
{ is_created: true,
referral_email: '[email protected]',
},
updatedAt: new Date("Wed, 22 Mar 2017 12:02:55 GMT")
}
}
)
但在蘋果的終端就說明此命令
Mongoose: companies.update({ _id: ObjectId("58d12e1a588a96311075c45c") }) { '$set': { billing: { configured: false, user: ObjectId("58d12e16588a96311075c45a") }, current_limit: {}, current_usage: {},referral: { is_created: true, referral_email: '[email protected]'}}, '$unset': { updatedAt: 1 } }
現在,我還沒有提到CURRENT_LIMIT和CURRENT_USAGE爲空。它在Windows上執行得很好,但在Mac上,它的設置爲current_limit和current_usage empty因此用Mac上的空對象更新我的文檔,但不是在Windows上。
它應該在兩個操作系統上表現相同的方式,但事實並非如此。