SoftwareBrothers / adminjs-mongoose

Mongoose adapter for AdminJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mongoose version 8 compatibility

VasilNikolov opened this issue ยท comments

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

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.

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

@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?

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

๐ŸŽ‰ This issue has been resolved in version 4.1.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€