I am using the following predicate to fetch data of a particular custom type(Student)
[any(my.student.name, ["ABC", "XYZ"])]
I get results if there is more than 1 document related to the student is published.
But I get a syntax error if there is no document published for that particular custom type.
"[function any(..)] unexpected field ‘my.student.name’ on line:1 col:7 in query"
Is this the expected behavior of prismic?
This is the expected behaviour at the minute when you are querying a document that doesn't exist. We hope to improve the error messaging in the future.
Hope this will be soon fixed as well.
Theses errors sound weird, if I push successfully a new field in the custom type, I don't expect this kind of error, any error... Just empty result.
It require currently to update at least one published document of the concern custom type, to at least one document get this new field, and so avoid the error but it's not user friendly and should not be required.
It remind me How to create 404 page for SSR single blog post? - #18 by webda2l / getByUID call with an unexisting uid trigger a 'api_parsing_error' error. · Issue #237 · prismicio/prismic-client · GitHub that was a similar case due to unpublished document.
@webda2l I agree that the user experience for this could be improved. I'll pass along your feedback to the product team to take into consideration.
Let us know if you have any other feedback on the product, it's always welcome!