1×
Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account
Autoplay

    Selecting multiple fields in an FQL query

    faunadbFaunaDB

    You can use array and object literals to compose multiple selections into a single query, such as within a lambda.

    Map(
      Paginate(Match(Index("all_customers"))),
      Lambda(
        "X",
        Select(["data", "firstName"], Get(Var("X")))
      )
    )

    with arrays

    Map(
      Paginate(Match(Index("all_customers"))),
      Lambda(
        "X",
        [
          Select(["data", "firstName"], Get(Var("X"))),
          Select(["data", "lastName"], Get(Var("X")))
        ]
      )
    )

    with objects

    Map(
      Paginate(Match(Index("all_customers"))),
      Lambda(
        "X",
        [
          Select(["data", "firstName"], Get(Var("X"))),
          Select(["data", "lastName"], Get(Var("X")))
        ]
      )
    )

    Map( Paginate(Match(Index("all_customers"))), Lambda( "X", { firstName: Select("data", "firstName", Get(Var("X"))), lastName: Select("data", "lastName", Get(Var("X"))) } ) )