Skip to content

Commit a3bdc3f

Browse files
authored
1.3
-fixed write concern
1 parent 1a9edbd commit a3bdc3f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mongo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
session_start();
66
$bg=2;
77
$step=20;
8-
$version="1.2";
8+
$version="1.3";
99
class DBT {
1010
private static $instance=NULL;
1111
protected $_cnx,$db,$bw,$wc;
@@ -25,7 +25,7 @@ public function select($con,$filter=[],$option=[]) {
2525
$qry=new MongoDB\Driver\Query($filter,$option);
2626
return $this->_cnx->executeQuery($con,$qry)->toArray();
2727
}
28-
protected function prepare($time=1000) {
28+
protected function prepare($time=5000) {
2929
$this->wc=new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY,$time);
3030
$this->bw=new MongoDB\Driver\BulkWrite;
3131
}
@@ -52,7 +52,7 @@ public function delete($con,$doc=[]) {
5252
return $result->getDeletedCount();
5353
}
5454
protected function execute($con) {
55-
return $this->_cnx->executeBulkWrite($con,$this->bw,$this->wc);
55+
return $this->_cnx->executeBulkWrite($con,$this->bw,[$this->wc]);
5656
}
5757
public function convert_id($doc,$oid='') {
5858
if($doc instanceof MongoDB\BSON\ObjectId) {

0 commit comments

Comments
 (0)