Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
examples/with-mongodb: avoid destructuring of environment variables. (v…
Browse files Browse the repository at this point in the history
…ercel#26029)

Greetings.

As per the [documentation](https://nextjs.org/docs/basic-features/environment-variables), we should not treat process.env as a Javscript Object & cannot destructure variables out of it. This PR avoid destructuring of environment variables in the `with-mongodb` example.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
  • Loading branch information
kasipavankumar authored Jun 13, 2021
1 parent d1ca76b commit 00ad0e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/with-mongodb/util/mongodb.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MongoClient } from 'mongodb'

const { MONGODB_URI, MONGODB_DB } = process.env
const MONGODB_URI = process.env.MONGODB_URI
const MONGODB_DB = process.env.MONGODB_DB

if (!MONGODB_URI) {
throw new Error(
Expand Down

0 comments on commit 00ad0e2

Please sign in to comment.