fix potential issue with setting geoNear.query to undefined (#6696)

* add test cases for geoNear aggregation

Test cases do not have the `query` parameter set in $geoNear aggregation stage. this is to test for a reported potential issue when the parameter is not set.

* fixed potential issue when setting the geoNear.query parameter to undefined

see dicussion in https://github.com/parse-community/parse-server/pull/6540

* fixed duplicate index name in test
This commit is contained in:
Manuel
2020-09-08 22:16:03 +02:00
committed by GitHub
parent 2e8e193f76
commit 5fd73a72fd
2 changed files with 76 additions and 3 deletions

View File

@@ -860,7 +860,7 @@ export class MongoStorageAdapter implements StorageAdapter {
stage.$project
);
}
if (stage.$geoNear) {
if (stage.$geoNear && stage.$geoNear.query) {
stage.$geoNear.query = this._parseAggregateArgs(
schema,
stage.$geoNear.query