In the case at hand, not sure why you have the v-if="prelist.HelAll[0]", i.e. checking the first position there. Changing this to v-if="prelist.HelAll.length" might help (canât check right now in js). But it also might be that youâre trying to access the missing subdocument in your for loop, in which case youâd need to add an if for that too (like @tomcio showed below).
Also, âapp crashâ is hardly a good way to describe an error. You really should find the time to at least copy the error from your console here to describe the situation. I think youâll find that once you get deeper into more complex problems having the habit of describing the problem well becomes essential to receive help.
is it possible to make a v-if where it will be true if there is a field starting with âHelâ like HelAll, Heldinner, Helbrunch⌠(need it for only show a title if true)
with mySQL i can do a âWHERE name LIKE âmat%ââ
Regex is an option (searching the values of fields, not the field names, by the way). But since you seem to be interested in meal times and thereâs only a limited amount of these, itâs likely far better to opt for a much simpler approach. If the data is already on the client in an object, just do an if with ||'s in your Vue code for the fields in question (Heldinner || Helbrunch || Helbreakfast). If it gets too noisy in the template you can separate it to a computed property. Or in mongo you can use the $exists operator on the fields. If you need to do anything more complex than that then itâs quite likely that the solution lies in altering the schema and not the queries.