Skip to content

Commit 68d4aee

Browse files
committed
create connection
1 parent 4d59c5c commit 68d4aee

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

connection.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const MongoClient = require("mongodb").MongoClient
2+
const connectionString =
3+
"mongodb://user_latihan:123456@localhost:27017?authSource=admin"
4+
const client = new MongoClient(connectionString, {
5+
useUnifiedTopology: true
6+
});
7+
(async () => {
8+
try {
9+
await client.connect();
10+
} catch (error) {
11+
console.error(error);
12+
13+
}
14+
})();
15+
module.exports = client

0 commit comments

Comments
 (0)