Skip to content
Back

Response Depth Relational Database

  • 0
  • REST API
carlvee
16 Nov, 2024, 00:55

if say I have a response that looked like this

{ "level 1" : "level 1", "level 2" : [ { "name" : "example name", "$id" : "32n1jnabsjdf", "level 3" : [ { "name": "name", "$id":"id", createdAt..., updatedAt..., other... } ] createdAt..., updatedAt..., other... } ]

Is there a way I can query it so it ONLY returns the level 2's name and id, also level 3's name and id, for example when I call getDocuments or listDocuments?

TL;DR
The developers can achieve this by using the MongoDB projection feature. They need to write a projection query specifying the fields they want to include in the response. For this case, they can include only "level 2.name", "level 2.$id", "level 2.level 3.name", and "level 2.level 3.$id" in the projection query to retrieve only those specific fields in the response.
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