SoftwareBrothers / adminjs-mongoose

Mongoose adapter for AdminJS
MIT License
14 stars 39 forks source link

Mongoose version 8 compatibility #112

Closed VasilNikolov closed 4 months ago

VasilNikolov commented 6 months ago

Hello, mongoose version 8 implemented some breaking changes which affected this package. Specifically in our case the deprecation of the findOneAndRemove method breaks all delete requests. I suspect there may be more. Version 8 has been release for nearly 2 months now and I think we should work on an update to support it.

More info here > https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md#800-rc0--2023-10-24

santiq commented 6 months ago

The same thing is happening to us.

It seems to be an easy fix, changing findOneAndRemove to findOneAndDelete;

in this line

https://github.com/SoftwareBrothers/adminjs-mongoose/blob/master/src/resource.ts#L158

I'm not sure if it will break the compatibility with the previous version, so maybe It should be released in a major release.

VasilNikolov commented 6 months ago

Yes It's entirely backwards compatible. I'll try to submit a PR.

VasilNikolov commented 4 months ago

@dziraf Santiq's PR seems to resolve the issue, which is a huge prod stopper for all of us. Any plans on getting it merged into a new version?

BigEnoter commented 4 months ago

Tried filtering the document & it looks like there's the same issue with count function, which is countDocuments now

github-actions[bot] commented 4 months ago

:tada: This issue has been resolved in version 4.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: