mardi 2 février 2016

laravel 5: Bulk insertion in mongo DB showing error

I am using jenssegers package in Laravel 5 for mongodb. I am inserting multiple data in this way and data is inserting successfully in mongodb but then it showing error before script completed.

$AllTrans=array();
$AllTrans[]=array("InvoiceID"=>1,"Amount"=>50);
$AllTrans[]=array("InvoiceID"=>2,"Amount"=>150);

$mongo_connnection->collection('invoices')->insert($AllTrans);

Here is error it is showing:

MongoException in Collection.php line 42: 
No write ops were included in the batch

But i can not figure out problem, I have tried to pass option like array('multi' => true) with insert query but it was not working.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire