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 ( ) {
@@ -22,7 +20,7 @@ async function run() {
22
20
// Print the number of deleted documents
23
21
console . log ( "Deleted " + result . deletedCount + " documents" ) ;
24
22
} finally {
25
- // Close the client after the operation completes
23
+ // Close the connection after the operation completes
26
24
await client . close ( ) ;
27
25
}
28
26
}
You can’t perform that action at this time.
0 commit comments