Function
Function( name, [database] )
Description
The Function
function returns a Reference for
the specified function name
in the specified child database
. If a
child database
is not specified, the returned function reference
belongs to the current database.
Returns
A reference to a function with the specified name
, in the specified
child database
(or the current database if database
is not
specified).
Examples
The following query gets a reference to the function named increment
:
client.query(
q.Function('increment')
)
.then((ret) => console.log(ret))
Function("increment")
The following query demonstrates how to retrieve the function document by its reference:
client.query(
q.Get(q.Function('increment'))
)
.then((ret) => console.log(ret))
{ ref: Function("increment"),
ts: 1581379483580000,
name: 'increment',
body: Query(Lambda("X", Add(Var("X"), 1))) }
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!