Another newbie question :slightly_smiling_face: Is...
# prisma-whats-new
j
Another newbie question šŸ™‚ Is it possible to get a list of IDs back from a query instead of a list of objects with id within? Like: features { id } => [ā€œid1ā€, ā€œid2"] instead of [{ā€œid1ā€}, {ā€œid2"}]
t
Doubt it since
allUsers
query implements Node and Node is an object
j
Yeah, but I thought there might be some cool feature like calling allUsersIds that returned list of user ids… there’s a lot of magic in GC so you never know šŸ™‚
t
so I just read the docs and it says everything uses the interface Node, but there could still be a chance lol if it is not in the docs
j
In the playground when typing a mutation I get intellisense suggestion like features & featureIds, that I can set either objects or IDs so I hoped it could go both ways šŸ™‚
t
Could I see a screenshot of that?
j
Pasted image in channel
t
@Josef Henryson let’s get back here haha
it is indeed an array but still with objects lol
this is posts as a nested relation to user
j
yeah, well, I guess I’ll just have to map the response client-side… just thought I should ask if there exist some convenicne function for this… no big deal šŸ˜„
thanks for your response anyway!
t
yup! any time
a
You could use a resolver function that returns an array of ID's, but that depends a lot on your use case. For example, you can't use that approach for an array of child items.
graphcool 1
j
Yeah, maybe there is even a better way to accomplish what I need. I have a post in GC acting as a template for other posts of a specific type. What I do is query the type of a specific ID to get it’s content which is a list of other objects. Then I create a new post with these values. Kind of a duplicate row (with different IDs) in an SQL db. Later this row/post can be modified but the original row/post/template should never be modified. I guess there is no ā€˜duplicate’ feature in GC? Anyway, when reading the first values I get them as a list of objects with IDs as only content. Then in my client I map this array to another array with IDs only. That list I then use to add into GC. Weird or the only way? šŸ™‚