Data Type help needed

Let’s say I have a Data Type called Chats, and another Data Type called Chat Messages.

If Chats has a field that is a list of Chat Messages and I want to add a new Chat Message item, do I add it directly to the Data Type of Chats, or to Chat Messages?

Thanks!

… it will die in convulsions :slight_smile:
Bubble recommends to keep list relatively small (~100 items max). Also list of things have a max cap of 10,000 items.

You are not correct.

As you can see Chat Messages is a Data Type, and not a regular Field – which Bubble’s recommendation is for.

What Bubble does recommend is described in Connecting types:

In practice, if you’re creating this kind of relationship and expect one thing to have a list of more than 100 values of another thing, we recommend going with Option 3 .

So in Chats data type you have a field that is a list of another data type Chat Messages
Don’t you expect one thing (Chats) to have a list of more than 100 values of another thing ( Chat Messages)? If yes - you’d better not use lists.

P.S. Also Bubble manual has a “Guides: Setting Up Your Database, by App Type” section, where members of the Bubble ecosystem contributed use case-oriented database guides. You can check an example data structure for a messaging app.

2 Likes

To answer your question specifically, you would add the Chat Message to the list of Chat Messages on the Chat datatype…

Having said that, I wouldn’t recommend having a list of Chat Messages on the Chat datatype…

It will cause all sorts of performance issues when loading your list of chats.

Instead, just have a Chat field on the Chat Message datatype.

1 Like

@Buddha Hello !

it’s a way to configure. But not the best.

I recommend that you do a Chat Type and a Chat Messaging Type.

in your chat type you do not put any link with the messaging chat

but in your type chat messaging you put a field chat of type chat

so to save your chat messaging you can do a create a new “chat messaging” with “chat”=“parent group’s chat”

now to retrieve a list of data relating to a particular “chat”, all you have to do is: search for chat messaging with the constraint “chat”=“parent group’s chat” and you deduce the information you want

This way of doing things allows you to work with a large range of information for sorting.

1 Like

Thanks a mil.

I appreciate the explanation and links.

It’s not a traditional chat app though, but a ChatGPT style application. The list of Chat Messages won’t be long. Will limit it to a max of about 30 and force the user to start a new chat.

1 Like

Thanks Adam, that was very helpful.

The app is styled after ChatGPT. I will limit the lists to about 30 items, before the user is forced to start a new chat.

Will it still cause performance issues if the list is limited to about 30 items?

no it shouldn’t do in that case (although in theory, it will still be less performant than doing it the other way as mentioned in this thread)