Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Using FQL Lambda 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




    Instructor: When running Paginate on a match of all documents in the 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 only a reference to the argument. Use whatever makes you happy.

    Next, we'll access that variable using Var. The result of Var, in this case, 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 for 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 results of that variable. Once you use Var, you can use any other function you want, such as Get or Select.