amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Unable to query for all connections

Open aehringer opened this issue 7 years ago • 2 comments

Describe the bug Abbreviated Schema: User @model { recommendations: [Recommendation] @connection(name:"User_Recommendation") } Restaurant @model { name: String! recommendations: [Recommendation] @connection("Restaurant_Recommendation") } Recommendation @model { caption: String! user: User! @connection(name:"User_Recommendation") restaurant: Restaurant! @connection(name:"Restaurant_Recommendation") } When I create a new recommendation, I see it created in the database. It has the proper recommendationUserId and recommendationRestaurantId fields. But when I query for the user or the restaurant (like below) I do not see all of the Recommendations that should be connected.

query getUser { getUser(id:"<proper_id_here>") { recommendations { items { restaurant { name } caption } } } }

To Reproduce

  1. Create a User
  2. Create a Restaurant
  3. Create multiple Recommendations with the User/Restaurant
  4. Attempt to query for the User's recommendations

Expected behavior All recommendations created should appear (w/ captions 1 - 19) when using this query: query getUser { getUser(id:"6b822cf0-4352-4170-b888-25d96d2de549") { recommendations { items { restaurant { name } caption } } } }

What I actually get: { "data": { "getUser": { "recommendations": { "items": [ { "restaurant": { "name": "Edo Salon" }, "caption": "Hair test 12 w/ photo " }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair 18" }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair 15 w/ photo " }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair 6 w/ photo" }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair test 3 w/ photo" }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair test1" }, { "restaurant": { "name": "Edo Salon" }, "caption": "Hair 4 no photo" } ] } } } }

Desktop (please complete the following information):

  • OS: iOS
  • Browser is chrome (version 74.0.3729.169)
  • Amplify 1.1.2

Smartphone (please complete the following information):

  • iPhone6s
  • OS: iOS 12.2
  • Browser: Chrome

aehringer avatar May 26 '19 22:05 aehringer

*Closed because the problem was not using nextToken properly

aehringer avatar May 27 '19 06:05 aehringer

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 27 '21 09:05 github-actions[bot]