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

161
Views
How to pass query parameters from Graphql Playground?

Here is my arrow function:

getUsers: async (
        _,  
        { offset = 0, limit = 10 },
        { req: { baseUserId } },     // How to pass this parameter from graphql playground
    ) => {
        console.log(baseUserId);
        return await tryCatch(async () => {
            const baseUser = await auth(baseUserId)  
            if (baseUser.userType !== 0) throw new Error('Error Found')

            const users = await User.find({})
                .populate('baseUser')
                .sort({ createdAt: 'desc' })
                .skip(offset)
                .limit(limit)
                .exec()  
            const result = users.filter((user) => user && user.baseUser)
            return users
        })
    },

Here is my graphql playground query:

query Read{
  getUsers(offset: 0, limit: 3) {
   _id
   createdAt
   updatedAt
   otherOccupations
 }
}

I don't know how to pass { req: { baseUserId } }, this parameter from query.

If any one knows please help.

Thanks in advance.

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!