fbpx

Understanding Bubble’s Data Type fields

Follow me:

When you set up a new Bubble application, a unique, encrypted relational database is set up specifically for your app. Apart from a few built-in fields, you decide exactly what the database should contain, and how data relates to each other.

Any of your data types in Bubble can have fields added to them. Data type fields are simply a spot reserved to save a specific kind of data that Bubble can recognize in the database. Fields can contain two different things:

Bubble’s built-in field types

Field nameDescription
TextAny kind of text, including bbcode, HTML or anything else
NumberNumbers, including decimals
Numeric rangeThe range between two numbers, such as 1-100
DateA date. Always contains both date and timestamp.
Date rangeThe range between two datetimes, such as January 1st 2021 00:00 and December 31st 2021 23:59
Yes/NoA true or false setting, often called a boolean. An empty value is returned as a NO.
FileThe URL of a file saved as text
ImageThe URL of an image saved as text
Geographic addressA Google Maps compatible address

Using Data Types in fields

Every Data Type that you create can be used as a field on another Data Type, to bind them together in the database. For example, your database may contain the following two Data Types:

  • User
  • Company

If you want to store which Company a User belongs to, you can create a new field on the User data type called Company. This way, you can save a Company stored in your database on a User and use that information to show it in your app or in a search to filter out User belonging to a specific Company.

List showing Bubble's Data Type fields, as well as a custom field
Create a new Field and pick the Data Type you want to use.

Saving a List of Things in a field

Sometimes you may need to store more than one thing, For example, the User from the last example may belong to only one Company, but several Teams. In Bubble, fields that contain more than one Thing is known as a list. In traditional coding, this is often referred to as an array.

When you create a new field in Bubble, you check the This field is a list (multiple entries) checkbox to tell Bubble that this field should contain more than one Thing:

Screenshot showing the Create a new field popup in Bubble
Check the This field is a list (multiple entries) box to create a field containing a List of Things in Bubble

Lists and Privacy Rules

Bubble’s way of handling security with Privacy Rules can be a bit confusing, and at worst can open up for potential security issues in your app. A common misunderstanding I see from new developers is the Find in searches option, which determines whether a Thing should be made available to a User or not.

In the example below, only Users who are logged in should be able to find this particular thing in a Search.

Bubble's Privacy Rules settings window
The Find this in searches Privacy setting is the most secure way to restrict access to Things, but does not apply to lists

It’s important to note the word Search here: When you perform a search in Bubble, it’s done in the following sequence:

  1. Search request received by server
  2. Privacy Rules applied
  3. Other Conditions applied
  4. Results returned to browser

As you can see, Privacy Rules are applied as an extra condition before other conditions are applied, and thus restricts forbidden data to every leave the server. When you use lists on the other hand, all of the content of the list will be downloaded to the browser when the Thing is loaded regardless of whether it’s protected by Privacy Rules. Thus, as a general rule, lists should only be used to store non-private information.

Note that this applies to finding the Thing in a list in general: hidden fields, attached files and auto-binding privileges still apply.

Bubble field type FAQ

What are field types in Bubble?

Field types are used to store different types of information in the Bubble database.

There are ten built-in types that can store information such as text, dates, numbers and URLs. You can extend fields to contain references to other Things stored in the database, and even to store a List (array) or Things.

Can I set up custom fields?

Yes. A field can contain any Bubble Thing as its field type. You can use this to set up a custom field.

For example, you may want to connect a User to the Company he works in. In that case, you would set up a Data Type called Company, and then set up a Field on the User where you pick the newly created Company Data Type as the field type. You can use this to show which Company a User belongs to, or in database searches, such as finding all Users belonging to a specific company.

How many fields can I save on a Thing?

There’s no limit to how many fields you can save on one Thing, but you should keep in mind that adding a lot of fields can lead to Bubble’s performance slowing down. For each field that you add, Bubble needs to go through more information and the total download size of each record will increase.

Support the site and keep it free ❤️

I love tech startups and the Bubble community, and have made it my mission to try and create content that’s valuable, easy to follow and entertaining.

Creating content next to full-time consulting work is time-consuming; if you’d like to support it and keep the site free for everyone, please consider buying me a coffee or becoming a supporting member.

Buy Me A Coffee

Follow me:
Bubble.io books

Learn Bubble the right way

Our professional Bubble books teach you how to plan, structure and build your applications right from the start.

5-star review stars

More Posts

2 Comments


luqmaan s
July 15, 2023 at 08:33
Reply

What are the benefits of using data type fields in Bubble applications, and how can they be used to establish relationships and organize data within the application’s database?


    Petter Amlie
    July 16, 2023 at 10:58
    Reply

    Hi there. It’s not really mostly about being beneficial: data type fields are how you establish relationships. If you come from a traditional database background you are probably used to “tables” (data types) using primary and foreign keys to set up relationships: in Bubble this is handled automatically by setting a data type for a given field. Under the hood, Bubble handles it in the same way (with primary/foreign keys), but the visual editor simplifies it to make it easier for those who don’t have a database background.

    The “Unique ID” field that’s automatically added to new data types is the key, but you only occasionally need to reference this directly.

Leave A Reply

Your email address will not be published. Required fields are marked *

*

Email icon

Useful articles and tips

Join the mailing list to get guides, opinions and articles on Bubble, no-code, automation and the tech industry.

We don't share your email address with anyone, and you can unsubscribe at any time.

You have successfully subscribed