File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
code-snippets/usage-examples Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ async function run() {
13
13
const database = client . db ( "sample_mflix" ) ;
14
14
const movies = database . collection ( "movies" ) ;
15
15
16
- // Query for a movie that has a title of type string
17
- const query = { title : { $type : "string" } } ;
16
+ // Query for a movie that has title "Annie Hall"
17
+ const query = { title : "Annie Hall" } ;
18
18
19
19
const result = await movies . deleteOne ( query ) ;
20
20
if ( result . deletedCount === 1 ) {
21
- console . dir ( "Successfully deleted one document." ) ;
21
+ console . log ( "Successfully deleted one document." ) ;
22
22
} else {
23
23
console . log ( "No documents matched the query. Deleted 0 documents." ) ;
24
24
}
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ Example
41
41
42
42
The following snippet deletes a single document from the ``movies``
43
43
collection. It uses a **query document** that configures the query
44
- to match only movies with a title of type ``string`` .
44
+ to match movies with a `` title`` value of "Annie Hall" .
45
45
46
46
.. include:: /includes/connect-guide-note.rst
47
47
@@ -66,9 +66,18 @@ to match only movies with a title of type ``string``.
66
66
The JavaScript and TypeScript code snippets above are identical. There are no
67
67
TypeScript specific features of the driver relevant to this use case.
68
68
69
- If you run the example above , you should see output that resembles the following:
69
+ If you run the example, you should see output that resembles the following:
70
70
71
71
.. code-block:: none
72
72
:copyable: false
73
73
74
- 'Successfully deleted one document.'
74
+ Successfully deleted one document.
75
+
76
+ Because you already deleted the matched document for the query filter,
77
+ if you attempt to run the example again you should see output that resembles
78
+ the following:
79
+
80
+ .. code-block:: none
81
+ :copyable: false
82
+
83
+ No documents matched the query. Deleted 0 documents.
You can’t perform that action at this time.
0 commit comments