@@ 31-39 (lines=9) @@ | ||
28 | $this->collection->createIndex($keys, $options); |
|
29 | } |
|
30 | ||
31 | public function insert($a, array $options = array()) |
|
32 | { |
|
33 | try { |
|
34 | $this->collection->insertOne($a, $options); |
|
35 | return ['ok' => 1]; |
|
36 | } catch (\Exception $e) { |
|
37 | return ['ok' => 0, 'error' => $e->getMessage()]; |
|
38 | } |
|
39 | } |
|
40 | ||
41 | public function update(array $criteria, array $newobj, array $options = array()) |
|
42 | { |
|
@@ 41-49 (lines=9) @@ | ||
38 | } |
|
39 | } |
|
40 | ||
41 | public function update(array $criteria, array $newobj, array $options = array()) |
|
42 | { |
|
43 | try { |
|
44 | $this->collection->updateOne($criteria, array('$set' => $newobj), $options); |
|
45 | return ['ok' => 1]; |
|
46 | } catch (\Exception $e) { |
|
47 | return ['ok' => 0, 'error' => $e->getMessage()]; |
|
48 | } |
|
49 | } |
|
50 | ||
51 | public function remove(array $criteria = array(), array $options = array()) |
|
52 | { |