⚠️ This lesson is retired and might contain outdated information.

Using FQL Lambdas in Array Functions

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

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.

Paginate(Match(Index("all_customers")))
Map(
  Paginate(Match(Index("all_customers"))),
  Lambda("X", Get(Var("X")))
)

Chris Biscardi: [00:00] 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.

[00:23] 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.

egghead
egghead
~ 12 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today