New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IS_MONGODB_CLOUD_URL turn into boolen #29
Conversation
Hi @tusheer bro. Thanks for your pull request. |
@tusheer bro you can try to use Nice find. I appreciate your efforts |
server/src/core/mongo.js
Outdated
@@ -1,6 +1,6 @@ | |||
const mongoose = require("mongoose"); | |||
require('dotenv').config() | |||
const isMongoDbUrl = process.env.IS_MONGODB_CLOUD_URL; | |||
const isMongoDbUrl = Boolean(process.env.IS_MONGODB_CLOUD_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use JSON.parse
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Bhaiya for your correction. This is really inspiring when I can communicate with you at least through the code. Happy coding Bhaiya.
@@ -1,6 +1,6 @@ | |||
const mongoose = require("mongoose"); | |||
require('dotenv').config() | |||
const isMongoDbUrl = Boolean(process.env.IS_MONGODB_CLOUD_URL); | |||
const isMongoDbUrl = JSON.parse(process.env.IS_MONGODB_CLOUD_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if IS_MONGODB_CLOUD_URL
is undefined
then we will face the same problem. Let's try JSON.parse(a ? a : 'false')
algo for now. 😎
Thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In connectWithDb function when we collect IS_MONGODB_CLOUD_URL from env it gives us a value as a string, So if we check is it false or true it always returns true. So I turn it into a boolean using the Boolean function.