Skip to content

FIX: replicaSets default to false after updating mongo due to default#4543

Open
linkthai wants to merge 1 commit into
Dokploy:canaryfrom
linkthai:fix/mongo-replicaSets-false-after-update
Open

FIX: replicaSets default to false after updating mongo due to default#4543
linkthai wants to merge 1 commit into
Dokploy:canaryfrom
linkthai:fix/mongo-replicaSets-false-after-update

Conversation

@linkthai
Copy link
Copy Markdown

@linkthai linkthai commented Jun 3, 2026

What is this PR about?

Fixes a bug where the replicaSets field on a MongoDB service would silently reset to false whenever any partial update was saved (e.g. editing ulimits, resource limits, or other advanced settings).

The root cause was that apiUpdateMongo is built from createSchema.partial(), but the base createSchema defines replicaSets: z.boolean().default(false). Zod applies that default even in a partial context when the field is absent from the payload — so any update that doesn't explicitly include replicaSets would write false to the database, overwriting the user's original setting.

Fix

Override replicaSets in apiUpdateMongo to z.boolean().optional(), removing the default so absent fields stay absent.

@linkthai linkthai requested a review from Siumauricio as a code owner June 3, 2026 19:15
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants