FileInfo GrahpQL type missing for array result

Hello there! I am rather new to Parse so I might be doing things wrong.

My Parse app has an “Item” class with a field called “images” which is an array that holds image files. I am using the JavaScript SDK to attach multiple files to the “images” field. This works fine, however the auto generated GraphQL schema does not seem to recognise that files are being attached to the “images” field.

The possible types for the “ArrayResult” are “Element”, “Role”, “Session”, “User” and finally the “Item” class itself. I would have expected that it would also include the “FileInfo” type which would allow me to query the files attached to the field.

Am I doing something wrong? Would it be better to create a separate class for files? Or is this expected behavior and I need to manually extend the GraphQL schema?

What if you do someArray { ...on Element { value } }? Anyways, it looks a limitation. Would you mind to open an issue on Parse Server repo? A separate class or custom schema also look good solutions.

Thank you for the quick reply! Sounds good, I could open a new issue.

I went for storing the image files in a field on the class because it seemed that:

  1. It would be easier to manage the relation between object and attached files
  2. This could help performance because less queries would be required than having the files in a separate class.

In your experience, are those assumptions valid? #1 could be subjective but is #2 valid?

My assumption was: if for instance the Item class has fields “images” and “docs” that both store files, then it would be more performant to query those as part of the object than having to query the item object + an additional query for files that match the relation and type.

I think that’s a valid architecture unless you believe that these arrays will have a large amount of numbers and/or will grow over time. MongoDB does not perform well with large arrays and/or growing over time.

1 Like