try { db.products.insertOne( { item: "card", qty: 15 } ); } catch (e) { print (e); };
try {
db.products.insertOne( { _id: 210, item: "box", qty: 20 } );
} catch (e) {
print (e);
}
try {
db.products.insertOne( { _id: 110, "item" : "packing peanuts", "qty" : 200 } );
} catch (e) {
print (e);
}
{ "acknowledged" : true, "insertedId" : 110 } > \
try { db.characters.bulkWrite( [ { insertOne : { "document" : { "_id" : 140, "char" : "Mani", "class" : "barbarian", "lvl" : 4 } } }, { insertOne : { "document" : { "_id" : 150, "char" : "Sana", "class" : "fighter", "lvl" : 3 } } }, { updateOne : { "filter" : { "_id" : 15 }, "update" : { $set : { "status" : "Critical Injury" } } } }, { deleteOne : { "filter" : { "char" : "Taeln"} } }, { replaceOne : { "filter" : { "char" : "Dithras" }, "replacement" : { "char" : "Tanys", "class" : "oracle", "lvl" : 4 } } } ] ); } catch (e) { print(e); }
{
"acknowledged" : true,
"deletedCount" : 1,
"insertedCount" : 2,
"matchedCount" : 2,
"upsertedCount" : 0,
"insertedIds" : {
"0" : 140,
"1" : 150
},
"upsertedIds" : {
}
}