Node: Knex postgres query doesn't trigger unless 'then' is appended

288 views Asked by At

I'm using Node with postgresql. I'm trying to do a knex query to the bd.

Why this query doesn't work without the then() call?

knex('test').insert(User1).then();
2

There are 2 answers

0
Sombriks On

it's because the framework expects you to either fulfill the promise or to invoke any other provided output interfaces

to chain the promise output is one of the cleaner ways to end the query building step, see this little example, hope it helps.

0
Tuan Anh Tran On

I think it's expected behavior.