MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Upsert non funziona per updateOne bulkWrite v3.4

const ops = items.map(item => 
           ({ updateOne: { 
              filter: { id: item.id, country: item.country}, 
              update: { $set: {item} }, upsert: true } 
           }));

$set per sintassi ci si aspetterebbe { id:item.id, country:item.country} non solo id:item.id, country:item.country superato.