Back

Atomic Document Update Operations

  • 1
  • Web
Haysquare
19 Apr, 2024, 17:04

Hello there I have a project that requires increasement and decreament of likes and comment and others, while many users maybe updating sulmultenously, that means getting document to check the latest count before updating maynot work as there might changes already before the whole process ends. I looked at the docs but nothing of such was found, Please how can I achieve that

TL;DR
Atomic document update operations are not currently supported. It is recommended to follow the GitHub issue for updates. Instead of incrementing likes directly, consider creating a separate "like" document to prevent multiple increments.
Steven
19 Apr, 2024, 17:57

This is not supported at the moment. Best to add a πŸ‘πŸΌ on https://github.com/appwrite/appwrite/issues/3905

For your case with "likes", it might be better to have a "like" document instead of incrementing because if you just increment, what's stopping someone from incrementing multiple times?

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