I have the following code:
var conditions = {_id: playerID, 'gameStats.GameID' : gameID},
    update = {$inc: {'gameStats.$.wins' : 1}},
    options = {new : true};
player.findAndModify(conditions, update, options, function (err, doc) {
    if (err) { 
        console.log("updated failed")
        return res.sendStatus(300);     
}
When I execute it the error message "TypeError: undefined is not a function" is returned and I really cannot figure out what is the problem. Can someone help?
 
    