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