Skip to content

withinKilometers withinMiles withinRadians not working with LocalDatastore #1571

Closed
@dplewis

Description

@dplewis

New Issue Checklist

Issue Description

Unsorted distance queries aren't supported on the LocalDatastore. Unsorted distance queries uses the $centerSphere + $geoWithin operators found here

Steps to reproduce

it(`LocalDatastore support unsorted distance queries`, async () => {
      const object = new TestObject();
      const firstPoint = new Parse.GeoPoint({ latitude: 40.0, longitude: -30.0 });
      object.set({ location: firstPoint });
      await object.save();
      await object.pin();

      const sorted = false;
      const query = new Parse.Query(TestObject);
      query.withinKilometers(
        'location',
        new Parse.GeoPoint({ latitude: 40.0, longitude: -30.0 }),
        2,
        sorted
      );
      query.fromLocalDatastore();
      const results = await query.find();
      assert.equal(results.length, 1); // Returns 0 objects
});

Actual Outcome

No objects are returned

Expected Outcome

Should return objects within a certain radius and distance

Environment

Server

  • Parse Server version: 5.3.0-alpha.27
  • Operating system: Mac OS 12.6
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Localhost

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Localhost

Client

  • Parse JS SDK version: 3.4.4

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions