Understanding Bubble’s Data Type fields

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.

Share:

More Posts

Understanding Bubble Groups

Bubble has five different group types. While they’re all used as containers, their use differs greatly. This article explains the difference between them in detail.

Bubble’s new expressions: SPLIT BY and ARBITRARY TEXT explained

Bubble quietly launched two new features in July 2021 that are quite useful: split by and arbitrary text. They’re both expressions that solve tiny problems that otherwise would require cumbersome workarounds, and are absolutely worth checking out. You’re not gonna

Combining icons and text in Bubble

Placing icons inside of your text elements by using BBCode is a quick way to reduce the total number of elements on your page and make sure your app runs smoothly. Read on for how to do it.

Leave A Reply

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

*