Update collection field from another field. A lot of row


#1

Hello! Can you some help me? :slight_smile:
I have next script:

for (const key in data) {
if ({}.hasOwnProperty.call(data, key)) {
const data_for_update = data[key];
Games.update({_id:collection._id, ‘item._id’:data_for_update._id},
{$set:{‘item.$.initiative’:(data_for_update.initiative+data_for_update.speed)}}
);
}
}

How it will be work with massive data? 2000 rows and more…
is it possible to do a mass update query? May be exist a best practice?

Thank you for wasted you time anyway! :slight_smile:


#2

Save my life :family:


#3

some examples :slight_smile: