Open ziaratban opened 4 years ago
MyActiveRecord::$batchInsertSize = 1000; foreach($myData as $data){ $obj = new MyActiveRecord(); $obj->field1 = 'data1'; $obj->field2 = 'data2'; $obj->field3 = 'data3'; $obj->batchSave(); #or batchInsert(); #no any database operation execute until count of insert operation equal MyActiveRecord::$batchInsertSize } MyActiveRecord::flushBatchInsert(); // executing the remaining operations. required.
or batchDelete() or batchUpdate
batchDelete()
batchUpdate
@ziaratban tests seems to fail: https://travis-ci.com/yiisoft/yii2-mongodb/jobs/293832598
or
batchDelete()
orbatchUpdate