From 0e4263d32f5e04790506251d98e56f98120bc4ef Mon Sep 17 00:00:00 2001 From: "jj@jjsweb.site" Date: Wed, 25 Aug 2021 12:45:09 -0500 Subject: [PATCH] lint-fix --- examples/with-mongodb/lib/mongodb.js | 24 ++++++++++++------------ examples/with-mongodb/pages/index.js | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/with-mongodb/lib/mongodb.js b/examples/with-mongodb/lib/mongodb.js index 65e84c19791f437..2990cffd2cac469 100644 --- a/examples/with-mongodb/lib/mongodb.js +++ b/examples/with-mongodb/lib/mongodb.js @@ -1,32 +1,32 @@ -import { MongoClient } from 'mongodb'; +import { MongoClient } from 'mongodb' -const uri = process.env.MONGODB_URI; +const uri = process.env.MONGODB_URI const options = { useUnifiedTopology: true, useNewUrlParser: true, -}; +} -let client; -let clientPromise; +let client +let clientPromise if (!process.env.MONGODB_URI) { - throw new Error('Please add your Mongo URI to .env.local'); + throw new Error('Please add your Mongo URI to .env.local') } 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(); + client = new MongoClient(uri, options) + global._mongoClientPromise = client.connect() } - clientPromise = global._mongoClientPromise; + clientPromise = global._mongoClientPromise } else { // In production mode, it's best to not use a global variable. - client = new MongoClient(uri, options); - clientPromise = client.connect(); + 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; \ No newline at end of file +export default clientPromise diff --git a/examples/with-mongodb/pages/index.js b/examples/with-mongodb/pages/index.js index 4882eb0006529d5..9628afb6523c74a 100644 --- a/examples/with-mongodb/pages/index.js +++ b/examples/with-mongodb/pages/index.js @@ -226,7 +226,7 @@ export async function getServerSideProps(context) { const client = await clientPromise // client.db() will be the default database passed in the MONGODB_URI - // You can change the database by calling the client.db() function and specifying a database like: + // You can change the database by calling the client.db() function and specifying a database like: // const db = client.db("myDatabase"); // Then you can execute queries against your database like so: // db.find({}) or any of the MongoDB Node Driver commands