New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing breaking change in v6 changelog: schema no longer inherits minimize option #10827
Comments
So on newer versions of 5 |
I took a closer look and this is expected behavior as of v5.10.5 with #9405. This is not a change in v6. As a workaround, you can either explicitly set const { Schema, model, version } = require('mongoose');
console.log(version);
const parent = new Schema({ child: { thing: Schema.Types.Mixed } }, { minimize: false });
const Parent = model('Parent', parent);
const p = new Parent({ child: { thing: {} } });
console.log(p.toObject()); // Contains `thing` in v6.x |
Sure, if it is expected behavior then this is instead an undocumented breaking change introduced in a patch version. |
@nomcopter correct. This change was meant to be a bug fix, but sometimes bug fixes break code :( Do you need any help getting a workaround or do you just think there should be a note in the 6.0 changelog? |
@vkarpov15 a note in the 6.0 changelog should cover it well at this point! |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
In v5, the minimize option seem to be inherited by child schema. This is no longer the case in v6. This should be considered at least a bug in the changelog
v5 -
v6 -
For easier copy-pasting -
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
The text was updated successfully, but these errors were encountered: