Skip to content

"minimize: false" is not working for it's own field #15313

Closed
@kuehn-sba

Description

@kuehn-sba

I have opened a new issue because Schema.Types.Mixed minimize: false not working #15177

cannot be reopened, but it is related and relevant and also reproducible.

No. It's a critical issue.

And you have to make a distinction here. “minimize: false” actually worked in mongoose5.x in such a way that it also affected the own object in the database and was not only allowed for all sub-objects. So you could also save the one field where minimize: false was directly as an empty object.

And secondly, the whole thing has been buggy since at least mongoose 7.x - possibly even 6.x. If the field is set to minimize: false and you try to save a new document (e.g. new MySchema(osbj).save()), then no empty object is created.

If, on the other hand, you save the field for an existing document (obj.save()), the empty object is saved! (as it was in mongoose5.x)

To make matters worse, it seems that you cannot read these empty objects in mongoose 7.x (in mongoose 5.x you can)
For me, the minimize: false feature has been properly bugged since the use of mongoose 7.x, which currently has to be productively modified unnecessarily by means of a workaround.

Originally posted by @kuehn-sba in #15177

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions