You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using mongoose with graphql via graphql-compose-mongoose with a schema that has nested relational documents. To populate the document for a query I have provided relation methods via addRelation, which works in the absence of graphql-shield permissions, but encounters an _idundefined error when using permissions - presumably because the graphql-shield middleware runs before the documents can be populated?
I have provided a minimal working example below. My question is how can I get this to work?
@m-lyon Hey there - running into the same issue (also trying to use graphql-compose-mongoose with graphql-shield). Did you figure out how to make it work?
@benfliu I can't remember exactly my reasoning, but looking at the project I was trying to use this in: I ended up not using graphql-shield and instead implemented my own permission guards via GraphQL-Tools resolver composition, which was pretty straight forward and didn't run into this error.
Got it! Thanks Matthew. Coming to a similar conclusion myself. Thought this library would save me time but looks like it might be more of a hassle than it's worth given this weird interaction
Question about GraphQL Shield
I am using
mongoose
withgraphql
viagraphql-compose-mongoose
with a schema that has nested relational documents. To populate the document for a query I have provided relation methods viaaddRelation
, which works in the absence ofgraphql-shield
permissions, but encounters an_id
undefined
error when using permissions - presumably because thegraphql-shield
middleware runs before the documents can be populated?I have provided a minimal working example below. My question is how can I get this to work?
Here is the output for said query:
The text was updated successfully, but these errors were encountered: