Return a value in bucket operations

Hello, is it possible to return a value inside a bucket operation.
Here is my code:

module.exports.isNewUser = function (user_id) {
bucket.get(user_id, function (err, result) {
if (err) {
return true;
} else {
return false;
}
});
}

This code don’t return any value. I can console.log() in if blocks, but can’t return true or false. Anyone see this issue before?

Hey @emrekap,

Node.js is an entirely callback driven language. Without using promises or coroutines, you will need to updated your “isNewUser” method to be callback based as well in order to provide the result once you’ve managed to receive the result from Couchbase.

Cheers, Brett