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
Add usePushEach
flag to Mongoose Schema Options
#23042
Add usePushEach
flag to Mongoose Schema Options
#23042
Conversation
In order for devs to be able to work around the issues described in Automattic/mongoose#5574 we need to be able to supply the `usePushEach` flag to the Mongoose SchemaOptions. This options functionality is described in Automattic/mongoose#4455 and is required for anyone who modifies arrays inline who is using Mongoose 4 and MongoDB 3.6+ Testing: Copied changes to local project and verified compilation worked.
@stieg Thank you for submitting this PR! 🔔 @simonxca @horiuchi @sindrenm @lukasz-zak - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@stieg Thanks! LGTM. |
A definition author has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
Did the option been added ? It's not there in 5.0.16.. |
Hrmm... Option was added in commit d512b1f but seems to have been removed in commit ccdc539 by Art a.molcanovas@gmail.com. Maintainers... know whats up with this? This because of mongoose 5 and this feature may be unnecessary now (my best guess)? |
The problem still exists with Mongoose (¢pushAll).. I did another PR for this and they added it.. Do you know any work around if they decide to remove it once again ? |
@EtienneBoutet I simply did a type assertion to work around the issue when defining my Schema Options. Something like this was my workaround const MySchema = new Schema({
...
}, {
timestamps: true,
usePushEach: true,
} as SchemaOptions); |
Thanks a lot ! 👍 |
In order for devs to be able to work around the issues described in
Automattic/mongoose#5574 we need to be able
to supply the
usePushEach
flag to the Mongoose SchemaOptions. Thisoptions functionality is described in
Automattic/mongoose#4455 and is required for
anyone who modifies arrays inline who is using Mongoose 4 and MongoDB
3.6+
Testing:
Copied changes to local project and verified compilation worked.
Please fill in this template.
npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If adding a new definition:
dts-gen --dt
, not by basing it on an existing project.tslint.json
should be present, andtsconfig.json
should havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
.If removing a declaration:
notNeededPackages.json
.