GET http://127.0.0.1:3002/api/fees
works fine and returns all the fees collection results but
GET http://127.0.0.1:3002/api/fees?where[student.value.number][equals]=10
or
GET http://127.0.0.1:3002/api/fees?where[student.number][equals]=10
results in a QueryError
fee collection fields -
fields: [
{ name: "description", type: "text", required: true },
{ name: "amount", type: "number", required: true },
{ name: "dueDate", label: "Due date", type: "date", required: true },
{
name: "paymentStatus",
label: "Payment status",
type: "select",
options: ["paid", "unpaid", "delayed"],
defaultValue: "unpaid",
required: true,
},
{
name: "student",
type: "relationship",
relationTo: ["students"],
hasMany: false,
required: true,
},
],
example result from general fetch
{
"docs": [
{
"id": "e33d9a6f-0a77-4d3c-aac8-16307732a132",
"description": "Initial",
"amount": 100000,
"dueDate": "2024-05-28T11:30:00.000Z",
"paymentStatus": "paid",
"student": {
"relationTo": "students",
"value": {
"id": "26e9dbea-7eaa-4e18-b36c-138e1a4432ac",
"studentId": 100,
"number": 10,
"dob": "2024-05-27T11:30:00.000Z",
...
The error-
{
"errors": [
{
"name": "QueryError",
"data": [
{
"path": ""
}
],
"message": "The following path cannot be queried: "
}
]
}
I am using postgres as the database
Bump
where[student.value.number]
this works ^ but you have to follow this
Example:
/api/trips?where[owner.email][equals]=tripOwnerEmail@gmail.com&limit=1&page=2
schema def:
{
name: "owner",
type: "relationship",
relationTo: "users",
hasMany: false,
required: true,
}
oh i see
thanks
Star
Discord
online
Get dedicated engineering support directly from the Payload team.