Fix issue on count with Geo constraints and mongo (issue #5285) (#5286)

* Add a tests that fails due to issue #5285

* Make test code much simpler

* Fix #5285 by rewriting query (replacing $nearSphere by $geoWithin)

All credit goes to @dplewis !

* move logic to transform
This commit is contained in:
Julien Quéré
2019-04-25 03:28:13 +02:00
committed by Diamond Lewis
parent 7e130c5421
commit 7122ca05c4
3 changed files with 73 additions and 16 deletions

View File

@@ -690,7 +690,7 @@ export class MongoStorageAdapter implements StorageAdapter {
readPreference = this._parseReadPreference(readPreference);
return this._adaptiveCollection(className)
.then(collection =>
collection.count(transformWhere(className, query, schema), {
collection.count(transformWhere(className, query, schema, true), {
maxTimeMS: this._maxTimeMS,
readPreference,
})