how is remove nested relation name "collection". Used many-to-many relationship.
request:
await db.query.products.findMany({
with: {
collections: {
columns: {
product_id: false,
collection_id: false,
},
with: {
collection: {
columns: {
id: false,
},
},
},
},
},
});
response:
[
{
"id": "0189a651-9ea3-79a7-a1c8-cd1d765c4717",
"name": "product 3",
"rating": 3,
"html_description": "product 3 desc",
"collections": [
{
"collection": {
"name": "collection1",
"description": "collection1 desc"
}
}
]
}
]
1 Reply
+1 to this issue. It is annoying when using relational query with many-to-many relation.