Answer the question
In order to leave comments, you need to log in
How to communicate with MongoDB?
I have an application, in it - registration. The data is collected, then simply transferred to MongoDB using mongoose. However, I ran into a problem: the appearance of new records causes the previous one to be overwritten. I quickly solved this problem by disconnecting from the database with mongoose.disconnect(); After that he writes to me:
Topology was destroyed.
user.password = hash;
user.login = req.body.login;
user.save(function(err){
mongoose.disconnect();
if(err) return console.log(err);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question