question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong query parameter for relations

See original GitHub issue

When running a query such as

const org: Organisation = ...
const found = await connection.manager.findOne(User, { organisation: org });

found is always undefined because the WHERE clause in the run query is:

WHERE "User"."organisationId"=$1 -- PARAMETERS: [{"name":"The Fancy Team","id":2}]

when it should be:

WHERE "User"."organisationId"=$1 -- PARAMETERS: [2]

See test case here: https://gist.github.com/angexis/ec9014a9d7a45ebb14dc5e3feea9e118

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
angexiscommented, Dec 4, 2017

(and OK, I will do a PR if I find another fix)

0reactions
angexiscommented, Dec 4, 2017

Hello @pleerock

Indeed, this is working in the next branch (hadn’t noticed that branch until you mentioned) and using typeorm@next (0.2.0-alpha.10).

So I guess I can close this bug now. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find entity with many-to-one relationship uses wrong id for ...
Look guys, I need some help with Room on Android. In my project there are two entities, Item and Unit of Measure. The...
Read more >
How do I see the query parameter on the error page
I have a GET request that is failing and I believe it's because some clients are sending us invalid query parameters.
Read more >
Incorrect construction of query with innerJoin and ... - GitHub
In MysqlDriver#escapeQueryWithParameters the :id placeholder is converted into a question mark and the value is appended to the parameter list, ...
Read more >
Error when activate custom OVS created for custom BO
When I create an OVS screen for custom BO and I try to activate it for the first time, I get the following...
Read more >
Use query parameters to customize responses - Microsoft Graph
Microsoft Graph provides optional query parameters that you can use to specify and control the amount of data returned in a response.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found