Node JS Not Equals Where Condition Doesn't Work

Node JS Not Equals Where Condition Doesn't Work

YOMYOM Posts: 53Questions: 22Answers: 1
edited October 2022 in Priority support

Version: "datatables.net-editor-server": "^2.0.10"

I've got a pretty basic where condition I'm trying to use.

new Editor(db, "amazon_order", "id")
      .where("upc", "<>", null)
      .fields(...)

This isn't working. Doesn't matter which not equals operator I use ("!=" or "<>") or which variation of the where syntax I use

How can I add a where condition to filter out null UPCs?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Try:

    .where(function() {
      this.whereNotNull('upc');
    })
    

    The Editor Node.js libraries just pass the query conditions over to Knex.js and their way of handling nulls is with a function specifically for that.

    Regards,
    Allan

Sign In or Register to comment.