Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
How do I create a lambda function for basic GraphQL filtering on FaunaDB?

I have a Query to filter my Premises by a query called premiseBySelectedFlag Like this.

 premiseBySelectedFlag(selected: Boolean!): [Premise!]!
    @resolver(name: "listAllSelectedPremises", paginated: true)

How do I create a function for this?

Currently, I have a basic function I use for my queries, like this

Query(
  Lambda(
    ["size", "after", "before"],
    Let(
      {
        match: Match(Index("latestSelectedPremises")),
        page: If(
          Equals(Var("before"), null),
          If(
            Equals(Var("after"), null),
            Paginate(Var("match"), { size: Var("size") }),
            Paginate(Var("match"), { after: Var("after"), size: Var("size") })
          ),
          Paginate(Var("match"), { before: Var("before"), size: Var("size") })
        )
      },
      Map(Var("page"), Lambda(["_", "ref"], Get(Var("ref"))))
    )
  )
)

But When i do this in my GraphQL playground

query{
  premiseBySelectedFlag(selected: true){
    data{
      _id
      content
      selected
    }
  }
}

I get this error in my GraphQL

{
  "errors": [
    {
      "message": "Lambda expects an array with 3 elements. Array contains 4.\n",
      "extensions": {
        "code": "invalid argument"
      }
    }
  ]
}

What is the correct way to create this function?

PS. I created the index latestSelectedPremises

enter image description here Is this correct?

Thank you

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!