FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. Fauna accounts created after August 21, 2024 must use FQL v10. These accounts will not be able to run FQL v4 queries or access the v4 Dashboard. For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions. |
Do
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Do( expression, ... )
do( expression, ... )
Do( expression, ... )
Do( expression, ... )
Do( expression, ... )
Do( expression, ... )
Description
The Do
function evaluates a list of expressions which are
provided as arguments. This evaluation occurs sequentially, from left to
right, ensuring that modifications made by earlier expressions are seen
by later expressions. If one of the expressions evaluated by
Do
returns an error, the current transaction is terminated and
none of the expressions' effects are persisted in the database. If all
of the expressions executed by Do
succeed, only the results of
the last statements executed are returned. If no expressions are
provided, Do
returns an error.
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
List of Expressions |
One or more expressions to be evaluated. |
Examples
The following query has a Do
statement with two expressions.
The first expression creates a document associated with the
"magical_creatures" collection, with a document ID of 2
. The second
expression retrieves the document from the ref containing the collection
"magical_creatures" and document ID of 2
. This was the document just
created in the previous statement. Only the results from the second
retrieving expression are returned.
{
ref: Ref(Collection("magical_creatures"), "2"),
ts: 1592269630010000,
data: { name: 'Orwen' }
}
{'ref': Ref(id=2, collection=Ref(id=magical_creatures, collection=Ref(id=collections))), 'ts': 1592948172680000, 'data': {'name': 'Orwen'}}
map[data:map[name:Orwen] ref:{2 0xc00009a210 0xc00009a210 <nil>} ts:1603747164000000]
ObjectV(ref: RefV(id = "2", collection = RefV(id = "magical_creatures", collection = RefV(id = "collections"))),ts: LongV(1603756298250000),data: ObjectV(name: StringV(Orwen)))
{ref: ref(id = "2", collection = ref(id = "magical_creatures", collection = ref(id = "collections"))), ts: 1594333377500000, data: {name: "Orwen"}}
{
ref: Ref(Collection("magical_creatures"), "2"),
ts: 1624310407590000,
data: { name: 'Orwen' }
}
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!