These are chat archives for Automattic/mongoose

15th
Dec 2018
Lamp
@ledlamp
Dec 15 2018 06:44
hey how can I exclude binary data from the debug log because whenever inserting a binary file it floods the log with massive amounts of base64
ERENKYI
@ERENKYI
Dec 15 2018 22:33
Hello
I'm trying to update multiple documents with the same criteria and same $set's and $inc's. I'm looping through the list and updating the documents one by one. Is there an easier way for this?
for (let i = 0; i < response.participants.length; i++) {
    let currentParticipant = response.participantIdentities[i].player;
    SummonerModel.findOneAndUpdate({
        accountId: currentParticipant.accountId.toString()
    }, {
        $inc: {
            'accountData.analyzedGames': 1,
            ... Many more values ...
        }
    }, {
        upsert: true,
        new: true,
        setDefaultsOnInsert: true
    });
}