Node JS Not Equals Where Condition Doesn't Work

Node JS Not Equals Where Condition Doesn't Work

YOMYOM Posts: 40Questions: 15Answers: 0
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: 57,703Questions: 1Answers: 9,195 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.