I have the following code that isn’t performing very well, and I’d like to know if there’s a way in Mongo to do it without iteration the array of records.
games.forEach(g => {
const { appid, ...game } = g;
Game.upsert({ appid }, { $set: game });
});
appid in this case is an index.
I want to know if I can run some query do accomplish this in one go, without the loop.