connect to mongoose#55
Merged
plarocque4 merged 2 commits intodevfrom Mar 15, 2023
Merged
Conversation
smalho01
previously requested changes
Feb 21, 2023
| this.client = new mongoDB.MongoClient(this.location); | ||
| this.database = this.client.db(this.db_name); | ||
| return resolve(this.client.connect()); | ||
| const dbString = `${this.location}/${this.db_name}` |
7bbf6e8 to
3d1fbe5
Compare
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.
Describe your changes
This introduces mongoose as the connection default. Though the code is relatively simple, moving forward we'll need to make some big changes to the way the app saves things to the database. Of note:
Removing Tingo
If we use mongoose then Tingo won't be relevant anymore, unless we want to use Tungus to make Tingo compatible with mongoose. Removal would be a relatively simple change. I'm not sure how much trouble it would be to use Tungus.
Restructuring the Globals
Right now to maintain the code as it is, I've had mongoose produce a MongoClient and pass it back so that the Globals have access to a database object exactly like before. The only difference in this PR is that instead of using Mongo functions directly, they're being used through mongoose. To use mongoose, we will no longer need the Globals database variables (
Globals.databaseClientisn't even used anyway), instead mongoose can be accessed globally by importing it into any module that needs it.Using Mongoose
Basically everything that utilizes the database will have to be modified to make use of the schema/model structure of mongoose. Then the functions that access the database will need to be changed to access through the models.
Issue ticket number and Jira link
REMS-338
Checklist before requesting a review
devnot main (the only exception to this is releases fromdevand hotfix branches)Checklist for conducting a review
Workflow
Owner of the Pull Request will be responsible for merge after all requirements are met, including approval from at least one reviewer. Additional changes made after a review will dismiss any approvals and require re-review of the additional updates. Auto merging can be enabled below if additional changes are likely not to be needed. The bot will auto assign reviewers to your Pull Request for you.