Answer the question
In order to leave comments, you need to log in
How to use variable as table column name?
The request looks like this
profileModel.findOneAndUpdate({_id: parseInt(user_id)}, {owner: badgeValue})
.then(() => {
done();
});
const name = "owner"
profileModel.findOneAndUpdate({_id: parseInt(user_id)}, {name || `${name}`: badgeValue})
.then(() => {
done();
});
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