Firebase Auth, Firestore & Storage (plugin)
  • 🚀Getting Started
  • Setup
    • Create a Firebase Project
    • Get Firebase access credentials
    • Offline Support
    • Secure your credentials and data
      • Restrict your api-key to your domain
      • Security Rules on Firebase
  • Plugin Elements
    • 🛠️About elements
    • 💾Data Schemas
    • Firebase Auth (Current User)
    • Firestore Data List
      • Firebase Geohash
      • Firestore Data (legacy)
    • Firestore Data Extractor
    • Firestore Data Single
    • Firestore Data Aggregation
    • Firestore Data Processor
    • Firebase Storage Upload Button
    • Firebase Action Listener
    • Firebase Dropdown Processor
  • Plugin Front-end Actions
    • 💻About front-end actions
    • 💾Field types table
    • Firestore
      • Create a new document
      • Update a document
      • Delete a document
      • Update a list of documents
      • Delete a list of documents
      • Batch Operations
        • Batch Operation Constructor
        • Batch Operation Commit
    • Firebase Auth
      • Sign the User Up
      • Log the User In
      • Log the User In with Google
      • Log the User In with Facebook
      • Log the User In with GitHub
      • Log the User Out
      • Update User's Profile
      • Update User's Password
      • Update User's Email
      • Send password reset email
        • Handle reset password code
      • Send verification email
        • Handle verify email code
      • Delete current user
    • Firebase Storage
      • Upload file base64
      • Delete uploaded file
  • Plugin Back-end Actions
    • ☁️About backend actions
    • Firestore Backend
      • Get a list of documents
      • Get a single document
      • Count a list of documents
      • Create a new document
      • Update a document
      • Delete a document
      • Update a list of documents
      • Delete a list of documents
    • Firebase Auth Backend
      • Create an account for someone else
      • Update another user's profile info
      • Delete a user account
      • Generate email confirmation link
      • Generate password reset link
      • Set user roles
Powered by GitBook
On this page
  • Inputs and Settings
  • Collection
  • Query type
  • Query sort / order by options
  • Query filters (list) (count)
  • Returned Values
  • List of documents
  • Docs IDs
  • Field Value Lists (1, 2, 3...)
  • Count
  1. Plugin Back-end Actions
  2. Firestore Backend

Get a list of documents

PreviousFirestore BackendNextGet a single document

Last updated 11 months ago

This action performs a query to get a list of documents from a Firestore collection, according to the provided query filters.


Inputs and Settings

Collection

The name or ID of the collection you want to get documents from.

Query type

Either "list" or "count". This will define the type of query you want to perform and will affect which values will be returned from the backend operation.

Query sort / order by options

This option will be ignored for "Count" query types.

You can choose a field to order your list of document from, at query level, specifying the sort direction (descending = yes | ascending = no).

When doing a sorted query for the first time, you might be confronted with an alert asking you to create an index for that query. That's a Firestore feature that creates different indexes for the database, which makes queries lighting fast.

Query filters (list) (count)

This options allow you to choose fields from which to filter your query.

Available query operators

Operator
Description

<

Gets values less than the provided input (must be of type number or date)

<=

Gets values less than or equal to the provided input (must be of type number or date)

==

Gets values equal to the provided input.

>

Gets values greater than the provided input (must be of type number or date).

>=

Gets values greater than or equal to the provided input (must be of type number or date).

array-contains

Gets values where the field of type array/list has the value provided as input.

array-contains-any

Gets values where the field of type array/list any of the array of values provided as input.

in

Gets values where the field value is present on the array of values provided as input.

not-in

Gets values where the field value is not present on the array of values provided as input.

Firestore supports only one filter of type "array-contains", "array-contains-any", "in" or "not-in" per query. If you try to use more than one, the first one will be considered by the plugin, but the other's will be ignored.

Types of filter values

Since Bubble is not flexible on the type of data we can define on plugins, the best way to implement our plugin was to work with texts. So each value you put on query values must be interpreted the right way to perform the Firestore Query. Defining a "query filter value type" can help us get it right.

So here are the types of query filter values:

Type
How it will be handled

auto

The plugin will try to infer the type from the input you provided.

text

Treated as a text value.

number

Treated as a number value.

boolean (true/false)

Treated as a true or false (yes/no) value.

date

Treated as a Date type. The plugin will convert the value to a Date.

array

Treated as a list in JavaScript format (e.g. ["item1", "item2", "item3"]). If you need to use it on Bubble's lists, you can apply the ":format as text" message to the list, to build the array string into that format.

reference (coll/doc_id)

Treated as a document reference. Document references are always handled by the plugin as paths to a document. For instance, if you want to get the reference for a document from the "tasks" collection with an id "1234", you should right "tasks/1234"

Arrays and lists are always handled in JavaScript notation, which means each value should be comma separated and must be between brackets.

An array of number should be provided as a text like: [1, 3, 45, 2]

An array of texts should contain balues between quotes: ["text1", "text2", "text3"]

Document references are always handled by the plugin as paths to a document. For instance, if you want to get the reference for a document from the "tasks" collection with an id "1234", you should right "tasks/1234"


Returned Values

List of documents

A list of document JSON strings, that can be provided to repeating groups and then, on each cell, extracted through a Firestore Data Extractor to get the values from the document fields.

Docs IDs

A list of texts contains the IDs of the document fetched from a "List" or "List and Count" type of queries.

Field Value Lists (1, 2, 3...)

Lists of fields you chose to retrieve from the documents list, with filters already applied.

Count

If the type of query is "count", this state will store the result of the couting operation.

On Firestore, on the count operation, each 1000 documents will account for 1 document read.

You can read more on the .

Firestore does not offer "text" filters like the Bubble "contains keywords" option, because of the way they structure the database using indexes. For this kind os searches they recomend the use of external services like .

Cloud Firestore documentation
Algolia
Query filter operators
Query filter value types