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
|Text||Any kind of text, including bbcode, HTML or anything else|
|Number||Numbers, including decimals|
|Numeric range||The range between two numbers, such as 1-100|
|Date||A date. Always contains both date and timestamp.|
|Date range||The range between two datetimes, such as January 1st 2021 00:00 and December 31st 2021 23:59|
|Yes/No||A true or false setting, often called a boolean. An empty value is returned as a NO.|
|File||The URL of a file saved as text|
|Image||The URL of an image saved as text|
|Geographic address||A 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:
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.
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:
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.
It’s important to note the word Search here: When you perform a search in Bubble, it’s done in the following sequence:
- Search request received by server
- Privacy Rules applied
- Other Conditions applied
- 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
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.
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.
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.