aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-04-18 15:41:50 +0700
committerFactiven <[email protected]>2023-04-18 15:41:50 +0700
commita1f276c7e5ac8e10c3816849eb71628dd4f0f504 (patch)
tree03117e80719b936938b06bb0e52bea0b9426c443 /lib
parentUpdate videoPlayer.js (diff)
downloadmoopa-a1f276c7e5ac8e10c3816849eb71628dd4f0f504.tar.xz
moopa-a1f276c7e5ac8e10c3816849eb71628dd4f0f504.zip
8th fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/mongodb.js30
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/mongodb.js b/lib/mongodb.js
deleted file mode 100644
index dbbf0dc..0000000
--- a/lib/mongodb.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb
-import { MongoClient } from "mongodb";
-
-if (!process.env.MONGODB_URI) {
- throw new Error('Invalid/Missing environment variable: "MONGODB_URI"');
-}
-
-const uri = process.env.MONGODB_URI;
-const options = {};
-
-let client;
-let clientPromise;
-
-if (process.env.NODE_ENV === "development") {
- // In development mode, use a global variable so that the value
- // is preserved across module reloads caused by HMR (Hot Module Replacement).
- if (!global._mongoClientPromise) {
- client = new MongoClient(uri, options);
- global._mongoClientPromise = client.connect();
- }
- clientPromise = global._mongoClientPromise;
-} else {
- // In production mode, it's best to not use a global variable.
- client = new MongoClient(uri, options);
- clientPromise = client.connect();
-}
-
-// Export a module-scoped MongoClient promise. By doing this in a
-// separate module, the client can be shared across functions.
-export default clientPromise;