12 Days of Baddass Courses sale! Get instant access to the entire egghead library of courses and lessons for 58% off.

Runs out in:
05 : 09 : 33 : 30

This lesson has been retired.

Become a member
to unlock all features

    Using FQL Lambdas in Array Functions

    Chris BiscardiChris Biscardi

    Lambdas allow you to use functions like Map or Filter effectively in FQL. In this lesson we should the Lambda syntax by operating on some paginated results.

      Lambda("X", Get(Var("X")))


    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Chris Biscardi: When running Paginate(Match(Index("all_customers"))), we get back a list of Refs. Let's say we want to get a field off of those Refs. We could use Map and set up a Lambda. We'll have to give the argument a name. In this case, X. The name here doesn't matter. It's just a reference to the argument.

    Next, we'll access that variable using Var. The result of Var is the Ref from the set above. We can use Get to get the document. Note that now we have a list of all of the documents with all of the fields. When using a Lambda, you always have to give the argument a name, and you always have to use Var to use the result of that variable. Once you use Var, you can use any other function you want, such as Get or Select.