Refs are opaque. To access the fields on a document associated with a
Ref, we first need to run
Get on our results and then we can access fields using
Map( Paginate(Match(Index("all_customers"))), Lambda("X", Get(Var("X"))) )
Map( Paginate(Match(Index("all_customers"))), Lambda("X", Select(["data", "firstName"], Get(Var("X")))) )
Instructor: [00:00] Here we have a query where we paginate on the match of all the documents in the index, all customers. We map over the resulting page set and get each of the refs. Let's say we don't want all the results, because it's quite long and we don't need to return them. Let's say the only field we need is the firstName. We can use Select for this purpose.
[00:24] In our Lambda, we'll add a call to Select. Note that we use the value of Get as the argument that we're operating on. To select through data into the firstName, we can use data and then firstName, because the result of Get is a single object and not the full result list. After running this, we can see that we've selected the first name from each of the documents.