I'm having trouble querying "belongsTo"
Here's my yaml.
name: TODO MVC Application
entities:
Todo:
properties:
- {name: "title", type: string}
- {name: "description", type: string}
- {name: "completed", type: boolean}
- {name: "order", type: number}
- {name: "createdAt", type: timestamp}
belongsTo:
- TodoList
TodoList:
properties:
- {name: "title", type: string}
- {name: "createdAt", type: timestamp}
and this is how I'm issueing the query with the SDK:
manifest.from('todos').with(['Todolist', 'Todolist.id']).where(
Todolist.id = ${todoListId}
);
But the API tells me this:
"Property Todolist.id does not exist in Todo"
I tried with other names, but haven't been able to get it to work2 Replies
Hello @Coquet the YAML is great but the issue resides in the
where
command in the frontend that should only include entity slugs:
The documentation is not very clear about it I am going to update it this morningI added a "querying relations" paragraph in the relations doc: https://manifest.build/docs/relations#querying-relations
Relations | Manifest Docs
Add a relationship between two entities, like an Invoice that belongs to a Customer, a Pet that belongs to an Owner, etc.