Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Support the ability to perform operations on multiple documents in a single request #4820

Open
2 tasks done
dilomor opened this issue Dec 6, 2022 · 4 comments
Labels
enhancement New feature or request product / databases Fixes and upgrades for the Appwrite Database.

Comments

@dilomor
Copy link

dilomor commented Dec 6, 2022

🔖 Feature description

support the ability to perform operations on multiple documents in a single request

🎤 Pitch

In my example, I have a contact list where I can select multiple contacts to perform actions on.

I want to delete these contacts, so I would use the deleteDocument method for each contact I want to delete. :
await databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
However, this would require making multiple separate requests.

To limit the number of requests and improve performance, it would be useful to have a method that allows me to delete multiple documents with a single request. This method could be called deleteDocuments :
await databases.deleteDocuments('[DATABASE_ID]', '[COLLECTION_ID]', ['[DOCUMENT_ID]', ...]);

The same logic could be applied for creating and modifying documents, using methods like createDocuments and updateDocuments.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@stnguyen90
Copy link
Contributor

Thanks for opening this issue! 🙏🏼

As a workaround right now, You can use an Appwrite Function so that your client app doesn't have to initiate several requests. In your Function, make sure to batch the API calls (100 or so requests) so that they execute concurrently rather than serially (ie. don't await each databases.deleteDocument()).

Related issue: #3051.

@stnguyen90 stnguyen90 added product / databases Fixes and upgrades for the Appwrite Database. feature labels Dec 6, 2022
@fanatic75
Copy link
Contributor

Hi@ @stnguyen90
Can you please assign this to me?

@stnguyen90
Copy link
Contributor

@fanatic75, thanks for your interest! 🙏🏼 It might be best to leave this to the core team for now, at least until we decide on the design/approach.

@ohbob
Copy link

ohbob commented May 29, 2023

I would love to see this feature as well, as it seems logical to have one.

@stnguyen90 stnguyen90 added enhancement New feature or request and removed feature labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request product / databases Fixes and upgrades for the Appwrite Database.
Projects
None yet
Development

No branches or pull requests

4 participants