Many To Many Relation not working #5802
Labels
datastore
Issues related to the DataStore Category
pending-triage
This issue is in the backlog of issues to triage
to-be-reproduced
Issues that have not been reproduced yet, but have reproduction steps provided
Description
when I declare Many To Many Relation and query models many-to-many list come with null value
Categories
Steps to Reproduce
GraphQL scheam
type Category @model @auth(rules: [{ allow: public }]) {
id: ID!
name: String!
order: Int
people: [Person] @manytomany(relationName: "PersonCategories")
}
type Taxonomy @model @auth(rules: [{ allow: public }]) {
id: ID!
name: String!
emoji: String
people: [Person] @manytomany(relationName: "PersonTaxonomies")
}
type Person @model @auth(rules: [{ allow: public }]) {
id: ID!
first_name: String!
last_name: String!
bio: String
city: String
country: String
image: String
job_title: String
organization: String
taxonomies: [Taxonomy] @manytomany(relationName: "PersonTaxonomies")
categories: [Category] @manytomany(relationName: "PersonCategories")
is_featured: Boolean
is_discoverable: Boolean
}
query person
final persons = await Amplify.DataStore.query(Person.classType);
print(persons.first.taxonomies);
taxonomies come with null value
and any many-to-many relation
also the data saved correct in data base and the GraphQL Request on API retrieve data
like this
Future customRequest2() async {
const document = '''
query GetPeople {
listPeople {
items {
id
first_name
last_name
bio
city
country
image
job_title
organization
is_featured
is_discoverable
industry {
id
name
}
taxonomies {
items {
id
taxonomy {
id
name
emoji
}
}
}
categories {
items {
id
category {
id
name
}
}
}
goals {
items {
id
goal {
id
name
}
}
}
}
}
}
''';
}
I don't know why DataStore does not retrieve taxonomies and categories with every person
Screenshots
No response
Platforms
Flutter Version
3.22.3
Amplify Flutter Version
^2.5.0
Deployment Method
Amplify CLI (Gen 1)
Schema
The text was updated successfully, but these errors were encountered: