Friday, 7 April 2017

Loopback near filter returns all objects

Near filter of loopback returns me all my objects or nothing. Tried different option but no correct result. Maybe I've skipped a step. Here is my code:

Status.getMeasurementPosition = function(userLocation, cb)
{
  const Measurement = Status.app.models.Measurement;
  Measurement
    .find(
      {
        where: { 
             location: { near: userLocation}
        },
        limit: 3},
        function(err,measurements){
          cb(null,measurements);
        });
}

userLocation is here a GeoPoint object.

Here is code from my measurement model

"location":{
  "type":"GeoPoint"    
  }

Hopefully can anyone help me with this.



via Fais

No comments:

Post a Comment