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

Stamplay.Query().near() not sorting by distance #40

Open
aleixpellicer opened this issue Aug 29, 2016 · 1 comment
Open

Stamplay.Query().near() not sorting by distance #40

aleixpellicer opened this issue Aug 29, 2016 · 1 comment

Comments

@aleixpellicer
Copy link

This:

var query = new Stamplay.Query('object', 'photo').near('Point',  [ 41.273237238849845, 1.6969573974609098 ], 900000, 0 );
query.exec().then(function(response){
  console.log(response.data);
});

should not only select within the given distances, but also sort by distance according to mongodb documentation:

The following example returns documents that are at least 1000 meters from and at most 5000 meters from the specified GeoJSON point, sorted from nearest to farthest:

   {
     location:
       { $near :
          {
            $geometry: { type: "Point",  coordinates: [ -73.9667, 40.78 ] },
            $minDistance: 1000,
            $maxDistance: 5000
          }
       }
   }
)```
@criroselli
Copy link
Contributor

Hi @aleixpellicer,
do you have a sort problem with this method ? Can you share with me more informations ?

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