art049 / art049/odmantic

Embedded Model Exclude None Not Functioning

Open
#353 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.2k
Forks
97
PR merge metrics
No merged PRs in 30d

Description

# Bug

Using 'exclude_none' in .update function does not work for fields in embedded models

### Current Behavior

Create 'model' with embedded model in field. Use 'exclude_none' in 'model.update(*, exclude_none=True). Field with non-null value becomes null in embedded model.

### Expected behavior

Fields in embedded model should not change from a non-null value to a null if exclude_none is set to True.

### Environment

- ODMantic version: odmantic==0.8.0

Contributor guide

Open the contributing guide

Research direction

Start at the model.update(..., exclude_none=True) path and reproduce the embedded-model case described in the issue. Trace how None values are handled during the update and verify that an existing non-null embedded field remains unchanged when exclude_none is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.