var user_poster = {}
db.carts.findOne(q, function(err, user_cart) {
if (err) return
next(err);
if(!user_cart) {
return res.send({"error": "art not found"});
}
cart_for_user(user_cart);
})
function cart_for_user(name) {global.user_poster = [name];}
console.log(user_poster);
I need to assign mongoDB response date to global variable.