File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed
source/code-snippets/usage-examples Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change 1
1
// Delete multiple documents
2
2
3
- // Import the MongoClient type from the mongodb package
4
3
import { MongoClient } from "mongodb" ;
5
4
6
5
// Replace the uri string with your MongoDB deployment's connection string
7
6
const uri = "<connection string uri>" ;
8
7
9
- // Create a new client and connect to MongoDB
10
8
const client = new MongoClient ( uri ) ;
11
9
12
10
async function run ( ) {
@@ -21,7 +19,7 @@ async function run() {
21
19
// Print the number of deleted documents
22
20
console . log ( "Deleted " + result . deletedCount + " documents" ) ;
23
21
} finally {
24
- // Close the client after the operation completes
22
+ // Close the connection after the operation completes
25
23
await client . close ( ) ;
26
24
}
27
25
}
You can’t perform that action at this time.
0 commit comments