June 2017
Intermediate to advanced
536 pages
9h 49m
English
Updating existing data is a nearly identical process as writing new data. The obvious difference being the use of the update() method on the MongoDBDriverBulkWrite instance:
<?phprequire_once __DIR__ . '/vendor/autoload.php';try { $manager = new MongoDBDriverManager('mongodb://localhost:27017'); $bulkWrite = new MongoDBDriverBulkWrite; $bulkWrite->update( ['name' => 'iPhone 7 Black White'], ['$set' => [ 'name' => 'iPhone 7 Black Black', 'price' => 649.99 ]], ['multi' => true, 'upsert' => false] ); $bulkWrite->update( ['name' => 'Samsung Galaxy S7 White'], ['$set' => [ 'name' => 'Samsung Galaxy S7 Black', 'price' => 669.99 ]], ['multi' => true, 'upsert' => false] ); $writeConcern = new MongoDBDriverWriteConcern(MongoDBDriverWriteConcern:: ...
Read now
Unlock full access