Why Getting Error When Updating Mongodb?
I am building backend with MEAN stack, but when I try to update document in the db i am getting an error: topUp = function(name, amount, callback) { User.updateOne( {
Solution 1:
I think it's not defined in the database driver that you might be using. I think you are using Mongoose and updateOne()
is not available there. You cannot use all native mongodb functions with all drivers
Solution 2:
There is an en existing enhancement request for this https://github.com/Automattic/mongoose/issues/3997 , but maybe the findByIdAndUpdate() method could be a close alternative.
Post a Comment for "Why Getting Error When Updating Mongodb?"