Function.all()

Learn: User-defined functions (UDFs)

Get the Set of all accessible user-defined Function documents.

Signature

Function.all() => Set<Function>

Description

The Function.all() method returns the Set of all UDF documents.

If Function.all() is the last value in a query, the first page of the Set is returned.

Staged schema

If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.

Parameters

None

Return value

Type Description

Set<Function>

Set of all Function documents in the current database. See Function.

Examples

Function.all()
{
  data: [
    {
      name: "validateOrderStatusTransition",
      coll: Function,
      ts: Time("2024-10-25T17:49:28.145Z"),
      body: <<-END
        (oldStatus, newStatus) => {
          if (oldStatus == "cart" && newStatus != "processing") {
            abort("Invalid status transition.")
          } else if (oldStatus == "processing" && newStatus != "shipped") {
            abort("Invalid status transition.")
          } else if (oldStatus == "shipped" && newStatus != "delivered") {
            abort("Invalid status transition.")
          }
        }
      END
    },
    ...
  ]
}

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!