Skip to content

Commit

Permalink
Removed duplicate MONGODB_URI check in example (#42518)
Browse files Browse the repository at this point in the history
This PR removes the duplicate check if the MONGODB_URI environment variable is set.
  • Loading branch information
sivtu committed Nov 5, 2022
1 parent dd3e851 commit 3913e4e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions examples/with-mongodb/lib/mongodb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MongoClient } from 'mongodb'

if (!process.env.MONGODB_URI) {
throw new Error('Invalid environment variable: "MONGODB_URI"')
throw new Error('Invalid/Missing environment variable: "MONGODB_URI"')
}

const uri = process.env.MONGODB_URI
Expand All @@ -10,10 +10,6 @@ const options = {}
let client
let clientPromise: Promise<MongoClient>

if (!process.env.MONGODB_URI) {
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).
Expand Down

0 comments on commit 3913e4e

Please sign in to comment.