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

230
Views
How to structure a 'select' FQL statement in javascript

I have a Fauna database with a collection "rooms" and an index "all_rooms_by_name"

I can run the query

Map(
    Paginate(Match(Index("all_rooms_by_name"), "57|65")),
    Lambda("roomRef", Get(Var("roomRef")))
)

in the Fauna shell and I get the expected response

[
{
    data: [Collection("rooms")]
},
{
    data: [
    Index("all_rooms_by_name")
    ]
},
{
    data: [
    {
        ref: Ref(Collection("rooms"), "336166823854604873"),
        ts: 1656852515940000,
        data: {
        name: "57|65",
        users: {}
        }
    }
    ]
}
]

I am trying to emulate this in javascript using the Fauna docs

const faunadb = require("faunadb");
const query = faunadb.query;
const client = new faunadb.Client({
    secret: process.env.FAUNA_SECRET
});

var query_function = client.paginate(
    query.Match(
        query.Index('all_rooms_by_name'),
        '57|65'
    )
)


var response = await client.query(query_function)

But it returns an error and response contains {}. What am I doing wrong?

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!