flatMap()
Parameters
Return value
Type | Description |
---|---|
Set of the result of calling function on each element of the calling set. The resulting set is flattened by one level. |
Examples
The following query uses map()
and returns a nested set. It uses Fauna’s
demo data.
{
data: [
{
data: [
{
id: "392698761120317504",
coll: Order,
ts: Time("2024-03-18T12:39:32.610Z"),
customer: Customer.byId("392698761099345984"),
...
}
]
}
]
}
The following query uses flatmap()
to flatten the returned set.
{
data: [
{
id: "392698761120317504",
coll: Order,
ts: Time("2024-03-18T12:39:32.610Z"),
customer: Customer.byId("392698761099345984"),
...
}
]
}
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!