Im trying to find the user in the stats, and if they dont exist, create them and give me the info.
Starting is executed, but i dont get any response on the other console.logs, or response.
How can i fix this to work?
console.log("starting");
var playerid = "57c435669f437e007b974fbb";
Crimestats.findAndModify({ query: { userid : playerid}, update: { $setOnInsert: { userid : playerid }}}).then( function(err, stats){
if (err) {
console.log(err);
}
console.log("got any results");
console.log(stats);
resolve(stats);
});
Only response is:
starting