Skip to content

Commit 808cb7e

Browse files
author
Mohammad Hunan Chughtai
authored
FAQ syntax improvements - upgrade to es6 & async/await syntax (#57)
* fix FAQ first literal include * upgrade to es6/async/await * added await to client connection
1 parent bbab2b3 commit 808cb7e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
const uri = "mongodb://localhost:27017/test?maxPoolSize=5000";
12
// create a new MongoClient
2-
const client = new MongoClient(
3-
"mongodb://localhost:27017/test?maxPoolSize=5000",
4-
);
5-
client.connect(function(err) {
3+
const client = new MongoClient(uri);
4+
5+
await client.connect(err => {
66
// connection
77
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Execute a find command
2-
collection
2+
await collection
33
.find({ $where: "sleep(100) || true" })
44
.maxTimeMS(50)
5-
.count(function(err, count) {});
5+
.count((err, count) => {});

0 commit comments

Comments
 (0)