try {
globalThis.addResult;
await game
.collection("game")
.findOne({ activity_id }, async (err, result) => {
addResult = result;
});
console.log(`this - ${addResult}`);
return { sucess: true, addResult };
ReferenceError: addResult is not defined
How can I set the variable and overwrite the value inside the mongoose query in order to return the value?