Closed svengau closed 3 years ago
Same issue here, I think 0.5.2 should not be a patch update. The minor version number should be pump up as it introduces breaking change / behavior change to project using overrideMethods: true/'all'.
@dsanel any update on this ?
@svengau do you still have this problem. If you can share your solution with us or make PR it will be super?
@dsanel, sorry, I don't work on this project and the related customer anymore. So I won't be able to reproduce easily.
@dsanel I have this issue. It happens when you use $geoNear
, e.g. like so:
await this.userModel.aggregate([{
$geoNear: {
near: userModel.location,
distanceField: 'distance',
maxDistance: userModel.maxSuggestionDistance ?? Number.MAX_VALUE,
key: 'location',
query: {}, // some random query
},
}])
My current workaround is to simply disable soft deletes override of aggregate
methods.
As an alternative workaround, it would be cool, if you could disable the softdelete for a single query, instead of for all methods. For instance:
await this.userModel.disableSoftDeletes.aggregate([{
That could also be a "quick fix" to this problem
Hi, I have the following error with version 0.5.2 when using geo localised queries:
MongoError: $geoNear is only valid as the first stage in a pipeline.
Indeed, the first item in the aggregate query is now "{ $match: { deleted: { '$ne': true } } }" rather than $geoNear.
As a workaround, I've overridden the overrideMethods option.