Skip to content

Many-to-one embedded resource is array when using in view #3618

Discussion options

You must be logged in to vote

I'm a bit confused with your first example. Did you mean to put collections instead of locations here?

    .select('*, locations(*), batch_category(*)'))

This will fail with "Could not embed because more than one relationship was found for 'batches_flat' and 'collections'".

Ah, maybe there's another FK column selected in the view that has a to-many relationship with the collections table. What's the full error here? In the hint there should be a message that says "Try changing 'collections' to one of the following...". If the fix you mention is like this in your view b.collection_id as ref_collection_id, then this should get the relationship that you want:

  const { data, error } = await 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@stefan-girlich
Comment options

@laurenceisla
Comment options

@laurenceisla
Comment options

@stefan-girlich
Comment options

Answer selected by stefan-girlich
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