A Ref is an object in FQL, not a string. The ID is a string. GraphQL abstracts this away.
The GraphQL “way” to do this is to get the item by its ID, i.e with findProdectById query, and then select the field you want in the result. No additional index is required.
To use the index you show, you would likely need to create a custom resolver to convert the id provided to a ref.
I noticed that the id is used by faunadb code (as shown in the rectangle) so I’m confused why it wouldn’t accept it when I introduce it
Maybe the the type Project should be altered in some way? That’s the only thing I suspect
If you have any idea, I would really appreciate it!
Thank you
You misunderstand what or have missed what I said.
To clarify, each Documents id is unique. That is, it’s Ref is unique and graphQL will send you the id. Searching by id AND anything else is redundant – do not try to search by ID + anything else. You can use just findProjectByID, and then query for the user.
{
findProjectByID(id: "1234") {
_id
_ts
user
name
}
}
If you want to search by id OR the user string, then you will need to create a UDF customer resolver.
beyond that you can start with the docs to try to develop Indexes that will work with GraphQL and if necessary custom resolvers.