{_where : what } zpracovává _where jako String doslovný, což je ekvivalent:{"_where":what} . Proto nezískáte žádné aktualizované výsledky, protože zde není žádné pole jako _where . Aby to fungovalo, musíte jej přiřadit níže uvedeným způsobem.
exports.updateUsers = function ( user_id, where, what, pass ) {
var _where = 'settings.'+where; //when I use it doesn't update
var update = {};
update[_where] = what;
user.findOneAndUpdate(
{'user_id' : user_id},
update).exec(function(e,d){
pass("ok")
})
};
update[_where] = what; řeší hodnotu v _where proměnná.