neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Only first result returned for custom query / resolver

Open infornite opened this issue 6 years ago • 2 comments

I have this bizarre behaviour whereby I only get the first result returned for a query. I assumed I am making some mistake but I really can't figure it out.

type Query {
    Idiom(
        name: String, 
        type: IdiomType,
        description: String,
        lifecycle: IdiomLifecycle,
        quality: Float
        _id: String
        first: Int
        offset: Int
        orderBy: [_IdiomOrdering]
        filter: _IdiomFilter
    ): Idiom 
}
const resolvers = {
  Query: {
    Idiom(object, params, ctx, resolveInfo) {
     if (!ctx.user) {
       throw new AuthenticationError('You must be authenticated!');
     } else {
        return neo4jgraphql(object, params, ctx, resolveInfo);
      }
    },
   }
};
MATCH (`idiom`:`Idiom`) RETURN `idiom` { .name } AS `idiom`
{
  "offset": 0,
  "first": -1,
  "cypherParams": {
    "currentUserId": "2f3df7b697aebe899fa5bd90012ffbe440537274"
  }
}

infornite avatar Jul 18 '19 10:07 infornite

hey @infornite shouldn't your return type be an array of Idiom like [Idiom]?? I think then you would get an array of type Idiom, not a single record

mattwr18 avatar Oct 24 '19 07:10 mattwr18

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham