This doesn't work because the Account.upsert
method uses the this
value and JavaScript has dynamic this
.
You can try binding it explicitly to the this value:
exports.fakeAccounts = function (Account, callback) {
async.map([{
username: 'Jehoon',
provider: 'farcebook'
}, {
username: 'C3P0',
provider: 'farcebook'
}], Account.upsert.bind(Account), callback);
};