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() {
1313 const database = client . db ( "sample_mflix" ) ;
1414 const movies = database . collection ( "movies" ) ;
1515
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" } ;
1818
1919 const result = await movies . deleteOne ( query ) ;
2020 if ( result . deletedCount === 1 ) {
21- console . dir ( "Successfully deleted one document." ) ;
21+ console . log ( "Successfully deleted one document." ) ;
2222 } else {
2323 console . log ( "No documents matched the query. Deleted 0 documents." ) ;
2424 }
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ Example
4141
4242The following snippet deletes a single document from the ``movies``
4343collection. 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" .
4545
4646.. include:: /includes/connect-guide-note.rst
4747
@@ -66,9 +66,18 @@ to match only movies with a title of type ``string``.
6666 The JavaScript and TypeScript code snippets above are identical. There are no
6767 TypeScript specific features of the driver relevant to this use case.
6868
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:
7070
7171.. code-block:: none
7272 :copyable: false
7373
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