1

I have a model that uses the memory connector. On the client side the REST-API request looks like this:

TrackedAircraft.find({ filter:
    { order: 'altitude ASC',
      where: { altitude: { neq: null }}
    }
}).$promise.then(function (results) {
      $scope.aircrafts = results;
});

"altitude" is a numeric value. Most of the time this works as expected, but like 1% of the requests end up with the default order.

Chris
  • 460
  • 10
  • 22
  • Can you post your code somewhere? I want to confirm the bug by reproducing it before filing an issue. – superkhau Dec 22 '14 at 18:18
  • I dug around a bit and found out that the sorting get's messed up when values are undefined. JS always returns false when comparing to undefined. Already filed a pull request. – Chris Dec 22 '14 at 20:11

1 Answers1

0

You can inspect your db queries in console, starting the app as

DEBUG=loopback:datasource slc run.

Add if queries will be correct, but response - not, dig deeper to db's result handler.

IvanZh
  • 2,265
  • 1
  • 18
  • 26
  • I tried getting debug output, but the memory connector doesn't seem to produce any output. – Chris Dec 21 '14 at 22:20
  • 1
    I think you should explore how filtering works. Try do debug `Memory.prototype.all` in node_modules/loopback-datasource-juggler/lib/connectors/memory.js. – IvanZh Dec 21 '14 at 22:34