Answer the question
In order to leave comments, you need to log in
Does not update the parameter in the database, what should I do?
It is necessary for each user in the database to update the parameter from false
totrue
let a = 123;
if(a == 123) {
User.find({}, (err, doc) => {
if(err) console.log(err);
User.updateMany({parametr: false}, {parametr: true});
});
}
Answer the question
In order to leave comments, you need to log in
Well, if each user is in the database, then this can be simplified to:
But your version with the search for everyone who should also work.
Not really, except, I understand, why the heck is this block with the search for all documents.
User.updateMany({}, { parameter: false })
if
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question