Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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();
like image 457
Cesar Giglio Avatar asked Mar 13 '26 19:03

Cesar Giglio


1 Answers

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.

like image 127
Sombriks Avatar answered Mar 15 '26 07:03

Sombriks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!