Why getting error when updating MongoDb?
<p>I am building backend with MEAN stack, but when I try to update document in the db i am getting an error: </p>

<pre><code> topUp = function(name, amount, callback) {
    User.updateOne(
        { "name" : name },
        { $set: { "wallet": amount } },
        function(err, results) {
            console.log(results);
            callback();
        });
 };
</code></pre>

<p><strong>TypeError: User.updateOne is not a function</strong></p>

<p>But e.g. findOne() works fine: </p>

<pre><code>    User.findOne({
                name: decoded.name
            }, function(err, user) {
                if (err) throw err;

                i

f (!user) {
                return res.status(403).send({success: false, msg: 'Authentication failed. User not found.'});
            } else {
                //res.json({success: true, info: {wallet: user.wallet, userPic: user.userPic}});
                topUp(decoded.name, amount, function() {
                    User.close();
                });
            }
        });
</code></pre>

<p>"User" is a Mongo model file.</p>