Upsert multiple items at once not working?


#1

I wanted to upsert multiple items at once but only one of the items (count) is upserted?

async function statusCodeUpsert(details, key, txt, count) { 
    var obj = {};
    obj[key] = txt;

    var promise = await new Promise(function (resolve, reject) {
        FutureTasks.upsert({
                number: details.number,
                userid: details.userid,
                start_date: details.start_date,
                end_date: details.end_date,
                 
            }, {
                $set: {
                    obj,
                    count: count,

                }
            }
            ,
             {
                 multi: true,
             }

            , (err, db) => {
                err ? reject(err) : resolve(db);
            }
        );
    });
    return promise;
}

Is this still the case :

"While you can run an update with both the upsert and multi flags, it will not have the effect that you want. You will need to run three individual upsert commands, as you are doing with your forEach example.

If you would like to have this feature added to a future relase of MongoDB, feel free to open a Jira ticket in the SERVER project"