Skip to content

Tag: knex.js

many to many relationship knex js

I am trying to fetch data from the database in this way: I want all the templates and those templates have an array of categories in it so the methode I am currently using currently I am doing this but the object doesn’t seem to alter. Answer You are not waiting for the promises to resolve. You should d…

Knex join on column belonging to same same table

Using Knex.js, I am attempting to query a table of users. The only columns that are important for this scenario are internal_id (key), name, and supervisor_id. Every user (except one) has a supervisor and their record stored the ID of that supervisor. When viewing an individual user record in my app, I want t…

(SQL) Pulling linked profiles from two tables using Knex

I currently have two tables with the following data: I currently have my query set up like this with Knex: I’m currently parsing the data into the following format: This works totally fine except for the cases where the parent has no children, as it won’t pull any data at all, including parent inf…