sql >> Base de Datos >  >> NoSQL >> MongoDB

Upsert no funciona para updateOne bulkWrite v3.4

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

$establecer por sintaxis esperaría { id:item.id, country:item.country} que solo id:artículo.id, país:artículo.país siendo aprobado.