Waterline ORM (sails.js) conditions with NOT Equal in query

javascript, node.js, orm, sails.js, waterline

Solution

First thing, it do nothing because looking into database is asynchronous. You have to make the chain longer and add exec or something from Q library like then.

User.count().where({
    id: { '!=': req.params.id },
    lastname: req.body.lastname
}).exec(function(err, num){
    console.log(num);
});

Now it returns 0. To make it return proper number instead of '!=' just write '!'.

Problem

How can I write a NOT Equal condition in Waterline? This code: ``` Users .count() .where({ id: { '!=': req.params.id}, lastname: req.body.lastname }) ``` Does nothing... (disk adapter in sails.js)

Original source