Do
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
Argument | 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 an id of 1. The second expression
retrieves the document from the ref containing the collection
"magical_creatures" and id of 1. This was the document just created in
the previous statement. Only the results from the second retrieving
expression are returned.
ObjectV(ref: RefV(id = "2", collection = RefV(id = "magical_creatures", collection = RefV(id = "collections"))),ts: LongV(1603756298250000),data: ObjectV(name: StringV(Orwen)))
map[data:map[name:Orwen] ref:{2 0xc00009a210 0xc00009a210 <nil>} ts:1603747164000000]
{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: 1592269630010000,
data: { name: 'Orwen' }
}
{'ref': Ref(id=2, collection=Ref(id=magical_creatures, collection=Ref(id=collections))), 'ts': 1592948172680000, 'data': {'name': 'Orwen'}}
{ref: ref(id = "2", collection = ref(id = "magical_creatures", collection = ref(id = "collections"))), ts: 1594673665600000, data: {name: "Orwen"}}
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums
or email docs@fauna.com
Thank you for your feedback!