Closed santiq closed 4 months ago
Hi @santiq
Thanks for contributing. There's one more issue that needs to be fixed until we're compatible with v8 and it's changing count
to countDocuments
when counting the number of records matching given filters:
https://github.com/SoftwareBrothers/adminjs-mongoose/blob/master/src/resource.ts#L71
The problem is that countDocuments
usage is a bit different and we need to make sure that it works with the provided filters.
Also, please bump mongoose
version in devDependencies
and peerDependencies
to v8. We can make it a breaking change.
@dziraf
According to [mongoose documentation ](https://mongoosejs.com/docs/api/query.html#Query.prototype.countDocuments())
The countDocuments() function is similar to count(), but there are a few operators that countDocuments() does not support.
Below are the operators that count() supports but countDocuments() does not, and the suggested replacement: $where: $expr $near: $geoWithin with [$center] (https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center) $nearSphere: $geoWithin with $centerSphere
It is safe to merge since people would need to upgrade to Mongoose v8 to use this anyway.
This deprecated method is already breaking many apps which uses mongo v8 so this should be fixed ASAP. Had to manually change findOneAndRemove to findOneAndDelete in node_modules for existing apps to function correctly.
:tada: This PR is included in version 4.1.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Fix #112