FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.


This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Map( array, lambda )
map_( lambda, array )
Map( array, lambda )
Map( array, lambda )
Map( array, lambda )


The Map function iterates on the provided array, calling the provided lambda function repeatedly with each item in array, and returns the results of all invocations in a new array of the same type (an Array or Page). As Map processes array, each invocation of the lambda function can see the effects of write operations from previous invocations.


Parameter Type Definition and Requirements


Array or Page

The target Array over which the Lambda function iterates/operates.


The anonymous function to be executed. It must accept one argument, which is the current item from array that is being processed.


A new Array with the results of calling the lambda function on each item in array.


The following query has a Lambda which takes one variable x, adds 1 to its value, and then returns the incremented value. This Lambda is executed once for each value in the array. These values are 1, 2, 3.

  q.Map([1, 2, 3], q.Lambda('x', q.Add(q.Var('x'), 1)))
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
[ 2, 3, 4 ]
result = client.query(
  q.map_(q.lambda_("x", q.add(q.var("x"), 1)), [1, 2, 3])
[2, 3, 4]
result, err := client.Query(
	f.Map(f.Arr{1, 2, 3}, f.Lambda("x", f.Add(f.Var("x"), 1))))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
[2 3 4]
    Value result = await client.Query(
        Map(Arr(1, 2, 3), Lambda("x", Add(Var("x"), 1)))
catch (Exception e)
    Console.WriteLine($"ERROR: {e.Message}");
Arr(LongV(2), LongV(3), LongV(4))
Map([1, 2, 3], Lambda('x', Add(Var('x'), 1)))
[ 2, 3, 4 ]
Query metrics:
  •    bytesIn:  74

  •   bytesOut:  20

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 0ms

  •    retries:   0

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!