How to query multiple document refs in GraphQL

@anders Apologize, I pasted a wrong UDF. Here is the correct one. You

 Update(
   Function("get_multiple_users"), {
     body: Query(
       Lambda(
         ["input"],
         Let({
             data: Map(
               Var("input"),
               Lambda("x", Get(Ref(Collection("User"), Var("x")))))
           },
           Var("data")
         )
       )
     )
   }
 )

You can test this from Shell

Call(Function("get_multiple_users"), [["291963324717859331", "291964514840084995"]])

[
  {
    ref: Ref(Collection("User"), "291963324717859331"),
    ts: 1614698029760000,
    data: {
      userName: "jay@fauna.com"
    }
  },
  {
    ref: Ref(Collection("User"), "291964514840084995"),
    ts: 1614698052700000,
    data: {
      userName: "jay1@fauna.com"
    }
  }
]

GraphQL API expects an Array of Users
getMulitpleUsers(UserId: [ID!]): [User!] @resolver(name: "get_multiple_users")
so, you have to make sure UDF returns the Array of Users.

2 Likes