Mongoose: findOneAndUpdate doesn’t return updated document

Why this happens? The default is to return the original, unaltered document. If you want the new, updated document to be returned you have to pass an additional argument: an object with the new property set to true. From the mongoose docs: Query#findOneAndUpdate Available options new: bool – if true, return the modified document rather than the original. defaults to false (changed in 4.0) Solution Pass {new: true} if you … Read more

mongoError: Topology was destroyed

It seems to mean your node server’s connection to your MongoDB instance was interrupted while it was trying to write to it. Take a look at the Mongo source code that generates that error This does not appear to be related to the Sails issue cited in the comments, as no upgrades were installed to precipitate … Read more

SocketException: Address already in use MONGODB

You already have a process running in the port 27017 which is used by mongodb. So either you need to stop the process in that port or try with different port number. Try mongod –port 27018 You can change the port number of your choice. EDIT: You can also just stop all the running instances of mongo server using sudo … Read more