Skip to content
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

query.withinKilometers() not working at all #5033

Closed
Zerokk opened this issue Sep 6, 2018 · 1 comment
Closed

query.withinKilometers() not working at all #5033

Zerokk opened this issue Sep 6, 2018 · 1 comment

Comments

@Zerokk
Copy link

Zerokk commented Sep 6, 2018

Issue Description

If I perform a geoquery to my server, it does not return anything. If I remove it, and perform a regular query, it works as expected. This leads me to think that something's missing either at the Parse docs, or something is failing at the server/SDK.

Steps to reproduce

I've got a collection for my app in which I have a table "Places", for which there is a column called "location", which type is GeoPoint. Got a few mockup places that are just at a few hundred meters from my place, which will be the initial geopoint to look for.

Expected Results

It should retrieve all of these mockup places.

Actual Outcome

The query returns nothing.

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.00
    • Operating System: Debian Linux (back), Windows 10 (front)
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): VPS
  • Database

    • MongoDB version: 3.2.11
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): VPS

Logs/Trace

Parse server logs have nothing in them.


Here you have my code:


            let query = new Parse.Query("Place");
            const geo = new Parse.GeoPoint(geopoint.lat, geopoint.lng)
            const res = await query.withinKilometers("location", geo, 200)        // TODO FIX
                            .include("placeType")
                            .find();

If I comment the .withinKilometers part, the query works and retrieves the data I want, but if I let it there, it will fail. I already checked if the "geopoint" data I receive at the method is okay, and it is. The problem must be either in the Parse Server, or Parse SDK.

@flovilmart
Copy link
Contributor

flovilmart commented Sep 6, 2018

We have many tests with the GeoPoints that cover this specific case with mock data.

At this time, you should probably double / triple / quadruple check your code and database contents.

The code you’re using doesn’t work as the geopoint variable you’re using is not defined. If coming from any of the SDK’s, the lat/lng are not valid properties.

Consider writing a test case that shows your issue including the creation of objects and the query to find them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants