Error is shown in the attached image. Is the error that there are plant_task documents where the plantId does not exist in the Plants collection?
I wish the error log was more descriptive of the error. Since there is no good UI for seeing the data, I am stuck as to why i am getting this error. The query works; just this dataset is missing something.
Your query is very wide, but the if you were able to see the error without line wrapping, then I believe you should see the error highlighted under .value.plantid.
The error states Cannot access `plantId` on null
You are only trying to access plantId on the value property for some Plant_tasks documents. So it is most likely that some of your Plant_tasks documents do not have a value property. When you access a field that does not exist it resolves to null, so when you execute .value it results in null when the field does not exist (Fauna does not store explicit null values).
Got it! Thanks @ptpaterson ! The docs where there was value field, were throwing the error. I used this query to quickly update them: Plant_tasks.all().where(.value == null).toSet().toArray().map(doc => doc.update({value:{}}))