Skip to content

Should I expect relations to be included in GQL results automatically when using this library? #226

Answered by TriPSs
abrenoch asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the repo, I have found the issue: The mapper expects all the types to be correct, your database is using bigint which causes the rawRelations to look like this:

[
  { categories_id: '1', categories_asset_id: '1' },
  { categories_id: '2', categories_asset_id: '1' }
]

As you can see all the id's are now string, if we change the big int to integer the raw relations look like this:

[
  { categories_id: 1, categories_asset_id: 1 },
  { categories_id: 2, categories_asset_id: 1 }
]

Now all the id's are numbers, which is can than correctly be mapped back to the real entities values.

So, long story short, you can disable this behaviour by setting bigNumberStrings in your TypeORM conf…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@TriPSs
Comment options

@abrenoch
Comment options

@abrenoch
Comment options

@TriPSs
Comment options

Answer selected by abrenoch
@abrenoch
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants