RG under RG. Comment Thread. Please Help!

Hi Guys, I just want to ask how can I make a comment thread under a post. For example, a comment having sub-comments. I am having a hard time configuring the data base on how to do it. I’ve read some previous post but still cant figure it out. Please help!

You could solve it by adding a field “Sub Comments” as a list of your data type “Comment”.
Post has a field “Comments” that is a List of Comment
Comment has field “Sub Comments” that is a List of Comment

2 Likes

One thing to be aware of about lists is that they are not performant once that list goes beyond 100 items…meaning it will take longer to load them if they were just a separate datatype with some kind of relation between the two.

Another thing to be aware of with lists is that Bubble max out lists at 10,000 items…so if a very popular post gets more than 10K comments, the list method is not going to be optimal.

What I do is I have a Datatype called ‘Comment’ which has a field that is a type ‘Post’ (this is how to relate them).

Then I have a Datatype called ‘Sub-Comment’ with a field that is a type ‘Comment’ (Another relation).

Then on the Post page, I have a repeating group which is a datatype of Comment which does a search for Comments with a constraint of Post is Current Page Post. In that repeating group I have a nested repeating group which is of a type ‘Sub-Comment’ and the datasource is a search for sub-comment with constraint ‘comment is current cells comment’.

This way I can have a more performant load when the number of comments and sub-comments grows beyond 100 and be sure that my app can scale and won’t stop adding comments or sub-comments at 10K.

3 Likes

Hi Sir, This is a very helpful information. I’m still trying to picture out how database works since I am still new to this platform. I just want to ask if you have videos/tutorials or maybe a youtube channel where I can follow you? Thanks!

Hi @drozhatvids please be on the lookout for the launch of my new platform…I’m in the process of creating a platform for trainers where they will be able to list their availability for bookings as well as video tutorials.

At the moment I do not have a space where I am offering videos/tutorials that I have created. I expect my platform will be ready within a month or so.

In the meantime, for help on database structure you may find a post I put up a while back helpful…

If you are interested in more training to jump start your development and feel 1:1 training sessions would be beneficial please PM me for details. I charge $100 USD per hour and offer a 10% discount on 10 hour bulk plans.

Hi Sir, I still cant picture it out. I still new to bubble that’s why it’s quite hard for me to understand how database works. Thanks!


image

Interesting, do you have the data to show that?

I often find that Bubble needs some time to build indexes when you have a lot of data.

Actually I think I confused something…the performance on lists is associated with backend workflows on lists…not the fetching of data.

However, I did some tests in the past when building an in app analytics and found the fetching of thousands of entries to be faster when they were entries of a separate data type rather than a field which was a list.

My tests were not documented, but after doing them I saw the noticeable speed difference and opted for the separate data type…this was in association with loading results using a repeating group: grouped by operation for drawing charts using JS.

The list limitation of 10K items is documented by Bubble, but I may be wrong about performance overall. I just recall from reading through the forum posts around the topic, that I took away from it that for larger data sets it is faster to use the separate datatype.

Think about it like this…

Imagine your row/record is like a Word Document instead of an Excel Row.

In your Word Document you can embed other documents. And those documents can have other documents etc etc

You just click to go down a level.

So a particular post is like a word document, and in there you can have a comment document.

In Bubble terms that is like having a Post “table” with a field of type Comment where Comment is ANOTHER “table”.

Now, imagine that instead of ONE document embedded in your Word Document you had a whole LIST of documents. So when you tried to open embedded document, you got a bunch back.

In Bubble terms that is like having a Post “table” with a field of type Comment where Comment is ANOTHER “table” and set to be a list.

image

So (as above) have a Post table. With a list of Comments. And the Comments has a list of Comments as well.

At this point the Word analogy breaks down a bit, but yes, you can embed something in itself !

Yeah, I have the same feeling. Just wondered if you had some data as well. Keep meaning to to do a proper test but other things come up :slight_smile: