M
Manifest3mo ago
Coquet

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 work
2 Replies
brunobuddy
brunobuddy3mo ago
Hello @Coquet the YAML is great but the issue resides in the where command in the frontend that should only include entity slugs:
const todos = await manifest
.from('todos')
.with(['todolist']) // Entity "TodoList" slug
.where('todolist.id = 21') // Here you can filter
.find()
const todos = await manifest
.from('todos')
.with(['todolist']) // Entity "TodoList" slug
.where('todolist.id = 21') // Here you can filter
.find()
The documentation is not very clear about it I am going to update it this morning
brunobuddy
brunobuddy3mo ago
I 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.
From An unknown user
From An unknown user
Want results from more Discord servers?
Add your server