You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/crud/delete.txt
+59-11
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,14 @@
4
4
Delete Documents
5
5
================
6
6
7
+
.. facet::
8
+
:name: genre
9
+
:values: reference
10
+
11
+
.. meta::
12
+
:keywords: remove, clear, reset, code example
13
+
:description: Learn about how to delete documents in the {+driver-long+}.
14
+
7
15
.. contents:: On this page
8
16
:local:
9
17
:backlinks: none
@@ -147,14 +155,54 @@ collection:
147
155
{ "_id": 1, "color": "red", "qty": 5 }
148
156
{ "_id": 8, "color": "black", "qty": 8 }
149
157
150
-
For more information about the methods and classes mentioned in this guide,
151
-
see the following resources:
152
-
153
-
- `deleteOne() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#deleteOne(org.bson.conversions.Bson)>`__ API Documentation
154
-
- `deleteMany() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#deleteMany(org.bson.conversions.Bson)>`__ API Documentation
155
-
- `findOneAndDelete() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#findOneAndDelete(org.bson.conversions.Bson)>`__ API Documentation
156
-
- `DeleteOptions <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/DeleteOptions.html>`__ API Documentation
157
-
- `FindOneAndDeleteOptions <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/FindOneAndDeleteOptions.html>`__ API Documentation
158
-
- :manual:`db.collection.deleteOne() </reference/method/db.collection.deleteMany/>` Server Manual Entry
159
-
- :manual:`db.collection.deleteMany() </reference/method/db.collection.deleteOne/>` Server Manual Entry
160
-
- :manual:`db.collection.findOneAndDelete() </reference/method/db.collection.findOneAndDelete/>` Server Manual Entry
158
+
.. _java-usage-deletemany:
159
+
.. _java-usage-deleteone:
160
+
161
+
Delete Example: Full File
162
+
-------------------------
163
+
164
+
.. include:: /includes/crud/example-intro.rst
165
+
166
+
The following code is a complete, standalone file that performs a delete one
167
+
operation and a delete many operation:
168
+
169
+
.. io-code-block::
170
+
171
+
.. input:: /includes/crud/Delete.java
172
+
:language: java
173
+
:dedent:
174
+
175
+
.. output::
176
+
:language: none
177
+
:visible: false
178
+
179
+
Deleted document count - query for one: 1
180
+
Deleted document count - unlimited query: 4
181
+
182
+
183
+
The queries in these examples use the ``eq()`` and ``lt()`` filters to query documents. For more
0 commit comments