I would like to create a comments section and store the comments as follows:
[
{
"name" = '',
"comment" = '',
"created" = Date.now()
}
]
and later would like to get the data as comments[0]?.name. I would like to store this as an array in the appwrite document. Is this possible?
Are you on Appwrite Cloud?
I highly recommend creating a collection of comments.
yes
Ok... but how am I supposed to link that to the documents?
like
each ducmunet in the posts will also have a document in the comments
but how am I supposed to like the,?
like in supabase
In Appwrite 1.3, we added built-in support for relationships. Unfortunately, Appwrite cloud is currently on version 1.1.2.
For now, you can have an array of strings in posts and put the document IDs of the related comments.
Or you can put the ID of the post in the comment and then you can fetch all the comments for that post.
okay
Recommended threads
- Cloud function deployment failures
When I run appwrite push functions, select the function I want to deploy, confirm with a YES, is starts deploying but goes into error. I need to repeat the ste...
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Failed to create function
Hey everyone 👋 I'm having an issue creating Functions on Appwrite Cloud and I'm not sure if it's a platform bug or something wrong in my project. When I try t...