Open
Description
I've a simple document with a StringField
with a default of an empty string (""
). When I retrieve a document, and save, it does not record it as a field in the db. This is the expected behaviour.
Annoyingly, though, there's a weird behaviour that I've observed. If I set the field to something other than the default, and save, it will record it in the db. Then if I set it to an empty string ""
again, the field is deleted from the db. This wouldn't be a big deal, but when I use a QuerySet
to do Whatever.objects(field="")
, it returns nothing as QuerySet
s do not work on non-present fields in the db even if they are defaulted. They're separate issues, so I'm focusing on the first.
Mongoengine version is: 0.22.1
mongo version: 4.0.8