-1
I am finding in the database the correct seller, however when I try to associate the sellerSupport variable to the value of the support object within the user, it Undefined me and I cannot associate the value.
let sellerSupport;
User.findOne({fullName: seller}, function(err, user) {
sellerSupport = user.support;
})
Someone would know how to fix it?
Your case is about callback, and not
Promise
. But it’s basically the same thing and the reason you can’t do that is the same. The question "How to assign a Promise result to a variable?" answers your question? :)– Luiz Felipe