Doing a 'not null' filter

627 views
Skip to first unread message

Puneet Goyal

unread,
Sep 9, 2014, 8:53:55 AM9/9/14
to loopb...@googlegroups.com
Hi,

I am trying to write a custom GET api on a model like so:

  Hotel.forWeb = function (externalId, cb) {
    this.find({where: {city: {$ne: null}}, order: 'createdAt DESC'}, function (err, hotels) {
      cb(null, hotels);
    });
  };

This is not executing the correct non null query in mongo. From the mongo profile collection:

  "query" : {
    "$query" : {
      "city" : "[object Object]"
    },
    "orderby" : {
      "createdAt" : -1
    }
  },

I have tried doing {where: {city: {neq: null}} as per http://docs.strongloop.com/display/LB/Where+filter as well.

Can someone point to what am I doing wrong?

Thanks,
Puneet

Puneet Goyal

unread,
Sep 9, 2014, 10:02:54 AM9/9/14
to loopb...@googlegroups.com
So I understand this is a bug [https://github.com/strongloop/loopback-datasource-juggler/issues/298]. Pointers on how can that be fixed? I'd be happy to help.

Puneet Goyal

unread,
Sep 9, 2014, 10:22:07 AM9/9/14
to loopb...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages