I'm running a discord bot and using a mongoDB database to talk to it.
async function checkPoint(arrayPoint, collection){
const trial = await collection.findOne({ [arrayPoint]: { $exists: true }})
if(trial == null){
console.log("Player didn't exist, ergo we make a new area for them, for our good player buddy " + arrayPoint)
tempObj = "1";
collection.insertOne({ [arrayPoint]: tempObj}, {arrayPoint} )
}else if(trial != null){
console.log("It seems we have data ! Aha !" + arrayPoint )
console.log(trial.arrayPoint)
value = parseInt(trial.arrayPoint);
console.log(value)
value = value + 1;
value = value.toString();
console.log(value)
collection.updateOne({name: {arrayPoint}}, {$set: {value}})
}
}
Instead of returning proper values, it returns
undefined NaN NaN
Trial itself is
{
'96773755035992064': '1'
}
any help would be appreciated I've tried everything in the documentation, and I don't really know what to do?