Skip to content

fix(server): use returnDocument 'after' instead of deprecated new: true - #107

Merged
SahinurDEV merged 1 commit into
SahinurDEV:mainfrom
O1sumitkumar:fix/mongoose-return-document
Nov 19, 2026
Merged

SahinurDEV merged 1 commit into
SahinurDEV:mainfrom
O1sumitkumar:fix/mongoose-return-document

Conversation

@O1sumitkumar

Copy link
Copy Markdown
Contributor

Description

Replaces the deprecated Mongoose { new: true } option with { returnDocument: 'after' } in the two update calls that used it:

  • server/src/controllers/formController.ts (updateForm, Form.findOneAndUpdate)
  • server/src/controllers/userController.ts (updateProfile, User.findByIdAndUpdate)

Behaviour is unchanged (both still return the updated document); this just removes the
[MONGOOSE] Warning: ... the \new` option ... is deprecatedmessage. Added a line under[Unreleased]→FixedinCHANGELOG.md`.

Related issues

Fixes #103

Type of change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation
  • 🔧 Chore / tooling

How verified

  • pnpm -F @form-builder/server test: before the change, 22/22 passed but the deprecation warning was printed 3 times; after, 22/22 passed with no [MONGOOSE] warning. The existing tests still lets the owner edit, read responses and delete (forms) and still updates the name (profile) assert the response carries the updated values, so returnDocument: 'after' is exercised for both calls.
  • pnpm -F @form-builder/server exec tsc --noEmit: clean.
  • pnpm format:check: all files pass.

Checklist

  • The server type-checks (pnpm -F @form-builder/server exec tsc --noEmit).
  • The client lints and builds — not run; no client files changed.
  • I formatted my code with Prettier.
  • No secrets, .env files, or debug console.logs are committed.
  • I updated documentation where relevant (CHANGELOG).

@netlify

netlify Bot commented Nov 18, 2026

Copy link
Copy Markdown

👷 Deploy request for frolicking-cascaron-4fab1f pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0e4ac0e

@SahinurDEV
SahinurDEV merged commit 716e52f into SahinurDEV:main Nov 19, 2026
1 of 3 checks passed
@SahinurDEV

Copy link
Copy Markdown
Owner

Merged — thank you @O1sumitkumar for the clean fix, the clear verification notes and the changelog entry! 🎉 This closes #103.

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.

Replace deprecated Mongoose new: true with returnDocument: 'after'

2 participants