GraphQuery breaks if new field is in the query

When I add a field to a customtype for example, and I use a graphQuery query to fetch that new field, all the existing documents that havent been saved with this new pushed field return an error response when fetched.

For example lets say I have a customtype called BlogPost, and a few months after its implemented we want to add a new field to this BlogPost, for example a field called "featured_image".

If I add this field, and then update the graphQuery query in my code to include this new feature_image field, it will return an error when trying to fetch all the posts that were created up to this point, so I have to manually go into every blog post and change some content to be able to update the document and have that new field added.

I think this should be fixed, as graphquery is sadly the only way to optimize queries for documents that have way too much data for some views that dont require it.

Hi @diego.arias94,

What you're describing is the intended behavior for graphQuery: if a newly added field hasn't been populated in older documents, those documents will not include that field in the query results. When you add a new field to existing custom types, you could always input a default value if that's possible. If it isn't or isn't ideal, what you could do is handle the error in your code so you're not running into roadblocks (for example with optional chaining such as featured_image?.)

If you want more details on this, feel free to share a little bit more about the error you're seeing, where you're seeing it, the queries you're running, and where/how you're using the response.