Skip to content

withinKilometers withinMiles withinRadians not working with LocalDatastore #1571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
dplewis opened this issue Oct 10, 2022 · 2 comments · Fixed by #1570
Closed
4 tasks done

withinKilometers withinMiles withinRadians not working with LocalDatastore #1571

dplewis opened this issue Oct 10, 2022 · 2 comments · Fixed by #1570
Labels
type:feature New feature or improvement of existing feature

Comments

@dplewis
Copy link
Member

dplewis commented Oct 10, 2022

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

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Oct 10, 2022
@mtrezza mtrezza linked a pull request Oct 10, 2022 that will close this issue
3 tasks
@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:bug Impaired feature or lacking behavior that is likely assumed labels Oct 10, 2022
@mtrezza
Copy link
Member

mtrezza commented Oct 10, 2022

Is this a feature or a bug fix? This issue uses the bug template but the descriptions seems more like a feature. The PR says feat, so I've changed this to feature for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants