| @@ 84-92 (lines=9) @@ | ||
| 81 | * |
|
| 82 | * @return int The count of the documents updated. |
|
| 83 | */ |
|
| 84 | public function update($criteria, Identifiable $updated, $multiple = false) |
|
| 85 | { |
|
| 86 | $limit = $multiple ? 1 : null; |
|
| 87 | $documents = $this->onMatch($criteria, $limit); |
|
| 88 | ||
| 89 | foreach ($documents as $document) { |
|
| 90 | $this->store->updateDocument($updated, $multiple); |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Remove documents from the collection. |
|
| @@ 102-113 (lines=12) @@ | ||
| 99 | * |
|
| 100 | * @return int The count of the document deleted. |
|
| 101 | */ |
|
| 102 | public function remove($criteria, $multiple = false) |
|
| 103 | { |
|
| 104 | $limit = $multiple ? 1 : null; |
|
| 105 | ||
| 106 | $documents = $this->onMatch($criteria, $limit); |
|
| 107 | ||
| 108 | foreach ($documents as $document) { |
|
| 109 | $this->store->removeDocument($document->getId()); |
|
| 110 | } |
|
| 111 | ||
| 112 | return true; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Find documents in the collection. |
|