Node.js - where condition only works as object or inside knex function

Node.js - where condition only works as object or inside knex function

btreebtree Posts: 99Questions: 14Answers: 11

Hoi,

seems like this problem was previously discussed, but documentation on homepage needs to be updated accordingly or the problem needs a fix.

(https://datatables.net/forums/discussion/60782/node-js-where-clause-stopped-working-after-updating-knex)

This wont work:

editor.where( 'user_id', 12 );

but the object variant works:

editor.where( {
    user_id: 12
} )

The object variant doesn't allow conditions, so I have to write the function variant as follows:

editor.where( function () {
    this.where( 'user_id', '>', 12 );
} );

Cheers
Hannes

Replies

  • allanallan Posts: 56,211Questions: 1Answers: 8,904 Site admin

    Hi Hannes,

    Thanks for pointing that out. It is an error on my part - apologies. I've committed the fix here.

    Regards,
    Allan

  • btreebtree Posts: 99Questions: 14Answers: 11

    Hi Allan,

    awesome thanks as always for the quick fix.

    Cheers
    Hannes

Sign In or Register to comment.