Questions tagged [objection.js]

An Object Relational Mapper (ORM) for Node.js

Formerly known as moron.js, objection.js is an Promise based ORM built on top of knex.js focusing on the loading and storing of javascript objects into relational databases, specifically the ones supported by knex.js.

It does not currently incorporate a query builder leaving that for knex.js.

Website: https://vincit.github.io/objection.js

Github repo: https://github.com/Vincit/objection.js/

284 questions
0
votes
1 answer

How to add dynamic Where queries in objection.js?

I have a table which has a global search bar that needs to trigger search for all fields like firstName, lastName, email and role. Also have a dynamic filter which can have single or multiple filter like "firstName" or/And "lastName" Obviously they…
0
votes
1 answer

Cloud Run deployed REST API failing on only specific endpoints

So I'm trying to deploy my NodeJS rest API on Cloud Run and for the most part it deploys successfully except a couple endpoints seem to be failing with either a 404 or 500 error. However when I run the container locally using docker run -p 8080:8080…
Ryker
  • 446
  • 3
  • 14
0
votes
1 answer

Get nearby records using lat lng with ObjectionJs and postgres, nodejs

I've been googling for a while now, can't find any way to use nearby query in my locations table which looks like this: id|lat|lng now what I want is, I've lat and long of a location, I want to search this table using those lat long with limit of…
Faisal Shahzad
  • 694
  • 9
  • 13
0
votes
1 answer

How to write a simple sql query using Objection.js

I need to write this mysql query with Objection.js but i can't figure it out how to properly write it. Here's the query (1276 is an example of an id in people table): SELECT MAX(c1.price) AS price FROM computers c1 WHERE c1.ownerId = 1276 AND NOT…
Frazcake
  • 11
  • 1
0
votes
1 answer

Injecting ObjectionJS model using NestJS throws exception

When I try to inject an Objection.js model into a NestJs service: constructor(@Inject('UserModel') private readonly modelClass: ModelClass) {} I get an Maximum call stack size exceeded error at compile time. I thought it was due to my…
Fluffy
  • 119
  • 3
  • 11
0
votes
1 answer

How can I select from a raw string in objection orm

I am trying to run a query from the results of another using with in the objection orm ex: Model.query().with(alias, query).select(columns).from(alias); according to the Knex documentation which is linked from the objection docs, this should work…
Marcus Ruddick
  • 9,795
  • 7
  • 28
  • 43
0
votes
1 answer

Jest tests did not exit (one second) after the test run has completed using a simple Express application

I have a simple Express application that exposes a RESTful API. It uses Knex and Objection to access the database, and Jest / Supertest for testing the API. I have a test that starts the server, fetches the available data from a given route and…
x80486
  • 6,627
  • 5
  • 52
  • 111
0
votes
2 answers

How to fetch all rows from objection.js

I am using Knex.js & Objection.js, I want to display country drop down so I need all rows but it was only returning me 10 rows. How do I override the pagination functionality? Is there any params I can set in url…
Pash
  • 345
  • 4
  • 11
0
votes
1 answer

create a new object of group of field in select query in objection js

I have one select query in Objections JS(NodeJs). That will return few fields. I need to modify the result. Suppose we have got below json from the response of the query. { group_id, group_name, link, created, user_id } I need to…
Rav's Patel
  • 743
  • 6
  • 22
0
votes
1 answer

Objection.js Eager is missing FROM clause

I am using objection js for PostGres and I try to find a payments with gift status of 'Closed' but i keep getting eror: missing FROM-clause entry for table Below is my query. const payments = await GiftPayments.query() …
john316
  • 83
  • 7
0
votes
1 answer

Unable to connect Objection/Knex to Heroku Postgres

I am running an express node app with objection.js which uses knex on Heroku. Whenever I make a request to an endpoint that makes a database connection, I get the following error. What does the error invalid_authorization_specification (code 28000)…
rjdb123
  • 33
  • 5
0
votes
1 answer

Can anyone translate this query into objection js query?

I am trying to join two tables and trying to distinct the id of parent table. SELECT DISTINCT ON(management_company.id) * FROM management_company INNER JOIN buildings on m_id = management_company.id ;
GetSome _
  • 59
  • 8
0
votes
2 answers

Using modifier with Objection.js relationmapping

I have four tables vehicle_parts, part_pricing, labour_pricing and paint_pricing. Vehicle_parts table is having one to many relationship with remaining tables. Each table is having a field is_active indicating whether record is active or not. So…
IrfanRaza
  • 3,030
  • 17
  • 64
  • 89
0
votes
0 answers

Get all data related throw multiple tables with Objection.js

How can I get data throw multiple tables, I have a table "Users" with relation many to many with "roles", "groups" and "permissions" and "roles" has a relation with "permissions" and "groups" to. users <-junction-table-> groups …
jon_eldiablo
  • 188
  • 2
  • 10
0
votes
1 answer

Using Objection JS How can I select specific columns with withGraphFetched

I have this question: How can I indicate which columns I want get from database with the withGraphFetched method, I have a BelongsToOneRelation and I want exclude some columns, this is my model: module.exports = class ProveedorModel extends Model…
jon_eldiablo
  • 188
  • 2
  • 10