LinkedIn_Accounts_schema.pre('initialize', function(doc) {
doc.linkedin = new LinkedIn(doc.access_token);
return doc;
})
LinkedIn_Accounts_schema.methods.call_API = function(callback) {
console.log(this); // able to access linkedin property
this.linkedin(...) // encountering ERROR undefined!!!
}
I urgently require the addition of the LinkedIn object directly into the document without persistent database storage.