Skip to content

Store empty list instead of unset - #2517

Closed
bagerard wants to merge 5 commits into
MongoEngine:masterfrom
bagerard:store_empty_list_instead_of_unset
Closed

Store empty list instead of unset#2517
bagerard wants to merge 5 commits into
MongoEngine:masterfrom
bagerard:store_empty_list_instead_of_unset

Conversation

@bagerard

@bagerard bagerard commented May 15, 2021

Copy link
Copy Markdown
Collaborator

Currently, if you set a ListField to an empty list, it unset it in the database instead of storing an empty list.
This is bad because it creates inconsistencies which can lead to confusion in queries

Fixes #267
Fixes #761
Relates to #2342

@vvladic

vvladic commented Mar 2, 2023

Copy link
Copy Markdown

any new developments regarding this?

@marcopetri98

Copy link
Copy Markdown

Will this PR be merged soon? Storing an empty list instead of performing an unset operation would be optimal for consistency

@bagerard

Copy link
Copy Markdown
Collaborator Author

got re-implemented in a better way in #2928

@bagerard bagerard closed this Aug 29, 2026
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.

item_frequencies returns {None: 1} if there's a single document with an empty list Confusing behaviour when ListFields are set to empty list

3 participants