Unverified Commit 2477b137 authored by D. Kasi Pavan Kumar's avatar D. Kasi Pavan Kumar Committed by GitHub

examples/with-mongodb: avoid destructuring of environment variables. (#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
parent 8afdaa3c
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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment