Skip to content
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

FIO-5471: Remove mongoose.save from codebase #1632

Merged
merged 10 commits into from
Jan 30, 2024

Conversation

mikekotikov
Copy link
Contributor

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-5471

Description

What changed?

Refactored code to not use mongoose.save()

Dependencies

formio-server:1082

How has this PR been tested?

Mostly by running tests

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@mikekotikov mikekotikov force-pushed the FIO-5471--Removed-mongoose.save-from-codebase branch from e1fc7db to 066d101 Compare October 6, 2023 09:38
if (!item) {
return Resource.setResponse(res, {status: 404}, next);
}

item.set(update);
options.hooks.put.before.call(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove the "options.hooks.put.before" hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@travist in that case 'before' hook was just marking 'data' as modified, which is not necessary after moving from .save() to .findOneAndUpdate(). And the 'after' hook was just calling next(). Here are the screenshots of those hooks:

Before:
CleanShot 2024-01-15 at 16 16 00

After:
CleanShot 2024-01-15 at 16 19 06

If there's a possibility to pass custom hooks to formio that override current ones, please tell me, I'll return those calls then.

@travist
Copy link
Member

travist commented Jan 30, 2024

👍

@travist travist merged commit 45928ab into master Jan 30, 2024
0 of 2 checks passed
lane-formio pushed a commit that referenced this pull request Apr 18, 2024
* FIO-5471: Removed mongoose.save from codebase

* FIO-5471: Add small fixes

* refactor submission patch

* fix formatting

* This is a combination of 2 commits.

FIO-5471: Add $set operator for mongoDb methods

---------

Co-authored-by: Travis Tidwell <travis@form.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants