Back

Can We Get Relation?

  • 0
  • Cloud
Back to Nogi💜
6 Feb, 2025, 12:20

I have a collection relation, can we get the collection via query for a single request and pick or select only a few column, for now i am using double fetch try { const data = await databasePublic.listDocuments( Deno.env.get("HONO_SINGLE_DATABASE_ID") as string, Deno.env.get("HONO_SINGLE_COLLECTION_MEMBERS_ID") as string, [Query.select(["name", "nameKanji", "$id", ])] // i wish we can get the relation via this

TypeScript
);
console.log(data.documents[0]["$id"])
if(data) {
  const url = await databasePublic.listDocuments(
    Deno.env.get("HONO_SINGLE_DATABASE_ID") as string,
    Deno.env.get("HONO_SINGLE_COLLECTION_GALLERY_ID") as string,
    [
      Query.equal("memberId",data.documents[0]["$id"] )
    ]
  )
  console.log(url)
  return c.json(url);
}
TL;DR
Developers want to know if they can fetch a collection relation in a single query and select specific columns to avoid double fetching. Current code snippet provided.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more