How to do bulk operations provided by Mongo Core Library?
http://docs.mongodb.org/manual/core/bulk-write-operations/
public function update(array $values, array $options = array()) will set $options['multiple'] = true; by default and update multiple records.
public function insert(array $values) uses batchInsert as well, to mimic Laravel insert behaviour.
public function delete($id = null) uses remove which remove multiple records as well.
It will work great with bulk addition, this way, you just need to create on array and pass it to it.
$temp = [
[
'item'=> "envelopes"
],`enter code here`
[
'item'=> "envelopesas"
],
[
'item'=> "lala"
]
];
$userData = DB::table('log')->raw( function ( $collection ) use ($temp) {
return $collection->insertMany($temp);
});
Most helpful comment
It will work great with bulk addition, this way, you just need to create on array and pass it to it.