I'm trying to make short way for me. I want to create one function for all queries. For settings.amount
, settings.balance
etc..
exports.updateUsers = function ( user_id, where, what, pass ) {
var _where = 'settings.'+where; //when I use it doesn't update
user.findOneAndUpdate(
{'user_id' : user_id},
{_where : what }).exec(function(e,d){
pass("ok")
})
};
How can I achive my want? Are there any way?