“MongoDB Bulk Update” Code-Antworten

MongoDB Bulk Update

const bulk = db.items.initializeUnorderedBulkOp();
bulk.find( { status: "D" } ).update( { $set: { status: "I", points: "0" } } );
bulk.find( { item: null } ).update( { $set: { item: "TBD" } } );
bulk.execute();
North Bear

Mongoose -Bulk -Update

Character.bulkWrite([
  {
    updateMany: {
      filter: { name: 'Eddard Stark' },
      // If you were using the MongoDB driver directly, you'd need to do
      // `update: { $set: { title: ... } }` but mongoose adds $set for
      // you.
      update: { title: 'Hand of the King' }
    }
  }
]).then(res => {
 // Prints "1 1 1"
 console.log(res.modifiedCount);
});
tumulr

Ähnliche Antworten wie “MongoDB Bulk Update”

Fragen ähnlich wie “MongoDB Bulk Update”

Weitere verwandte Antworten zu “MongoDB Bulk Update” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen