node.js - mongo - better solution when i have to update each mongo document usually? -
let say, if have document this, , collection have huge documents.
{ _id: objectid('e1312313dddqqe….'), ra: { energy: 80, times: 1377496519 } }
i have update ra.energy (per 15 mins), use formula
var pow = (now - ra.times) / 86400; ra.energy = ra.energy * ( math.pow(0.5, pow) );
currently, use cronjob, query each documents, calculate , update each ra.energy field, slow down our mongodb.
is there have better design update. suggestion?
thanks.
Comments
Post a Comment