NexJs is completely new framework for me and I've been studying it.
I'm following this video tutorial and one of the steps is to create a file next.config.js. In this file I put:
module.exports ={
env: {
MONGO_URI: "mongodb+srv://username:pwd@cluster0.yxxxx.mongodb.net/ricoapp?retryWrites=true&w=majority"
}
}
And later I connect to mongo db like this:
console.log('1: ', Object.keys(process.env).includes("MONGO_URI"));
console.log('2: ', "MONGO_URI" in process.env);
console.log('3: ', typeof process.env.MONGO_URI);
console.log('4: ', Object.getOwnPropertySymbols(process.env));
console.log('5: ',process.env.MONGO_URI);
const db = await mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
In the console I get the following output:
1: false
2: false
3: string
4: []
5: mongodb+srv://username:pwd@cluster0.yxxxx.mongodb.net/ricoapp?retryWrites=true&w=majority
So the MONGO_URI is somehow available trough process.env.MONGO_URI but is it seems to me not a property of process.env.
What am I missing here? This doesnt make sense to me.