Back

Accessing db collection with document permission from server side

  • 0
  • Self Hosted
  • Functions
  • Databases
Lxz
21 Jul, 2024, 05:43

Hi, struggling with accessing db collection with document permission from server side. An example:

  • I have collection with document permission enabled named user_file_queue, where authenticated users save URL of file to download.
  • I have a NodeJS server function, that should go over user_file_queue records and download those files (started by CRON).
  • Also, there is another table, called user_downloaded_files, where file_id is saved after file is download to bucket.

How can I get all records from user_file_queue as server side function? As it stated in docs: When using a Server SDK in combination with the proper API key scopes, you can have any type of access to any of your project resources regardless of their permissions. I assume that server function should have access to all documents in the table, but seems like that is not the case as db.listDocuments() returns 0 rows. Any help is appreciated, thank you.

TL;DR
Developers are struggling with accessing a database collection with document permissions from the server side in NodeJS. They have a collection named `user_file_queue` where authenticated users save file download URLs. They also have a server function that should download files from this collection. The goal is to access `user_file_queue` records from the server-side function. The developers are facing issues with `db.listDocuments()` returning 0 rows even though they have the necessary API key scopes. Unfortunately, it seems that server-side functions do not have access to all documents in the table as assumed.
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