Fix: Move MongoDB URI to environment variables#10
Merged
Aryan3522 merged 4 commits intoAryan3522:mainfrom Mar 13, 2026
Merged
Conversation
Root Cause: The frontend NoteCard component was already designed to display a folder icon when `note.folderId` exists. However, the Note schema did not contain `folderId` or `folderName`, so this value was always undefined. Changes: * Added `folderId` and `folderName` fields to the Note schema * Updated folder controller logic to stamp these fields when a note is added to a folder * Cleared these fields when a note is removed from a folder Result: Notes inside folders now correctly display the folder icon on the note card, while normal notes do not. Tested: * Adding note to folder -> icon appears * Removing note from folder -> icon disappears * Normal notes remain unchanged
Aryan3522
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removed the hardcoded MongoDB connection string from the source code and replaced it with an environment-based configuration.
Changes
Config/db.jsto usemongoose.connect(process.env.MONGODB_URI)MONGO_URLtoMONGODB_URItest-db*.js) to useprocess.env.MONGODB_URIrequire("dotenv").config({ path: "./Config/config.env" })where requiredConfig/.env.examplewith placeholder values.gitignoreto prevent committing the real environment configuration fileResult
The MongoDB URI is no longer hardcoded in the repository.
All database connections now use environment variables, improving security and configuration management.