| @@ 90-98 (lines=9) @@ | ||
| 87 | * |
|
| 88 | * @return int The count of the documents updated. |
|
| 89 | */ |
|
| 90 | public function update($criteria, DocumentInterface $updated, $multiple = false) |
|
| 91 | { |
|
| 92 | $limit = $multiple ? 1 : null; |
|
| 93 | $documents = $this->onMatch($criteria, $limit); |
|
| 94 | ||
| 95 | foreach ($documents as $document) { |
|
| 96 | $this->store->update($updated); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Remove documents from the collection. |
|
| @@ 108-119 (lines=12) @@ | ||
| 105 | * |
|
| 106 | * @return int The count of the document deleted. |
|
| 107 | */ |
|
| 108 | public function remove($criteria, $multiple = false) |
|
| 109 | { |
|
| 110 | $limit = $multiple ? 1 : null; |
|
| 111 | ||
| 112 | $documents = $this->onMatch($criteria, $limit); |
|
| 113 | ||
| 114 | foreach ($documents as $document) { |
|
| 115 | $this->store->remove($document->get('_id')); |
|
| 116 | } |
|
| 117 | ||
| 118 | return true; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Find documents in the collection. |
|