Skip to content

Commit 7d0e33d

Browse files
committed
JM most feedback
1 parent 6d499f6 commit 7d0e33d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

source/includes/write/delete.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010

1111
// Deletes a document that has a "name" value of "Ready Penny Inn"
1212
// start-delete-one
13-
$result = $collection->deleteOne(['name' => 'Ready Penny Inn']);
13+
$collection->deleteOne(['name' => 'Ready Penny Inn']);
1414
// end-delete-one
1515

1616
// Deletes documents that have a "borough" value of "Brooklyn"
1717
// start-delete-many
18-
$result = $collection->deleteMany(['borough' => 'Brooklyn']);
18+
$collection->deleteMany(['borough' => 'Brooklyn']);
1919
// end-delete-many
2020

2121
// Deletes matching documents and attaches a comment to the operation
2222
// start-delete-options
23-
$result = $collection->deleteMany(
24-
['name' => new MongoDB\BSON\Regex('Mongo', '')],
23+
$collection->deleteMany(
24+
['name' => new MongoDB\BSON\Regex('Mongo')],
2525
['comment' => 'Deleting Mongo restaurants'],
2626
);
2727
// end-delete-options

source/write/delete.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Modify the Delete Operation
8888
---------------------------
8989

9090
You can modify the behavior of the ``MongoDB\Collection::deleteOne()`` and
91-
``MongoDB\Collection::deleteMany()`` methods by by passing an array that
91+
``MongoDB\Collection::deleteMany()`` methods by passing an array that
9292
specifies option values as a parameter. The following table describes the
9393
options you can set in the array:
9494

@@ -100,12 +100,13 @@ options you can set in the array:
100100
- Description
101101

102102
* - ``collation``
103-
- | Specifies the kind of language collation to use when sorting
104-
results. For more information, see :manual:`Collation </reference/collation/#std-label-collation>`
103+
- | Specifies the kind of language collation to use when comparing
104+
strings. For more information, see :manual:`Collation </reference/collation/#std-label-collation>`
105105
in the {+mdb-server+} manual.
106106

107107
* - ``writeConcern``
108-
- | Sets the write concern for the operation.
108+
- | Sets the write concern for the operation. This option defaults to
109+
the collection's write concern.
109110
For more information, see :manual:`Write Concern </reference/write-concern/>`
110111
in the {+mdb-server+} manual.
111112

@@ -159,8 +160,9 @@ methods return a ``MongoDB\DeleteResult`` object. This class contains the
159160
following member functions:
160161

161162
- ``isAcknowledged()``, which returns a boolean indicating whether the operation
162-
was acknowledged
163-
- ``getDeletedCount()``, which returns the number of documents deleted
163+
was acknowledged.
164+
- ``getDeletedCount()``, which returns the number of documents deleted. If the write
165+
operation was not acknowledged, this method throws an error.
164166

165167
If the query filter does not match any documents, the driver doesn't delete any
166168
documents and ``getDeletedCount()`` returns ``0``.

0 commit comments

Comments
 (0)