GraphQL query returning null fieldsHow to check empty/undefined/null string in JavaScript?How can I get query string values in JavaScript?event.preventDefault() vs. return falseHow to determine if variable is 'undefined' or 'null'?Is there a standard function to check for null, undefined, or blank variables in JavaScript?How to retrieve POST query parameters?How to get GET (query string) variables in Express.js on Node.js?Why does ++[[]][+[]]+[+[]] return the string “10”?How do I return the response from an asynchronous call?npm WARN package.json: No repository field

What city and town structures are important in a low fantasy medieval world?

How to become an Editorial board member?

Was Tyrion always a poor strategist?

Is being an extrovert a necessary condition to be a manager?

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

Farthing / Riding

Warped chessboard

Is it wise to pay off mortgage with 401k?

How to play vs. 1.e4 e5 2.Nf3 Nc6 3.Bc4 d6?

What are the domains of the multiplication and unit morphisms of a monoid object?

Is there a realtime, uncut video of Saturn V ignition through tower clear?

Are CTRL+C and <esc> the same?

How would a physicist explain this starship engine?

Department head said that group project may be rejected. How to mitigate?

How to safely discharge oneself

Why does an injection from a set to a countable set imply that set is countable?

How to tease a romance without a cat and mouse chase?

How to prove the emptiness of intersection of two context free languages is undecidable?

How do you cope with rejection?

1950s or earlier book with electrical currents living on Pluto

Does the fact that we can only measure the two-way speed of light undermine the axiom of invariance?

Does science define life as "beginning at conception"?

How to counter "I don't like your tone" in a work conversation?

Simple Arithmetic Puzzle 7. Or is it?



GraphQL query returning null fields


How to check empty/undefined/null string in JavaScript?How can I get query string values in JavaScript?event.preventDefault() vs. return falseHow to determine if variable is 'undefined' or 'null'?Is there a standard function to check for null, undefined, or blank variables in JavaScript?How to retrieve POST query parameters?How to get GET (query string) variables in Express.js on Node.js?Why does ++[[]][+[]]+[+[]] return the string “10”?How do I return the response from an asynchronous call?npm WARN package.json: No repository field






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am writing a GraphQL schema for data with a scores array of different sizes. The data is for quiz scores. The quiz varies in size based on how many people took the quiz.



When I submit the query, I get null back for "answered" and "correct".



I want to get back all the scores for each quiz. I wrote the schema with a ScoreType that has the "answered" and "correct" fields. I'm not sure if the schema is the problem or how I am querying the data.



Here is the JSON file for the quizzes



[

"length": "15",
"average": "77",
"created_at": "2019-02-01",
"course": "MATH311",

"scores": [

"correct": "12",
"answered": "14"
,

"correct": "9",
"answered": "15"

]
,

"length": "25",
"average": "17",
"created_at": "2019-02-03",
"course": "MATH301",

"scores": [

"correct": "11",
"answered": "14"
,

"correct": "17",
"answered": "25"
,

"correct": "20",
"answered": "22"
,

"correct": "18",
"answered": "24"

]

]


Here is the GraphQL schema



const Quiz = new GraphQLObjectType(
name: "Launch",
fields: () => (
length: type: GraphQLInt,
average: type: GraphQLInt,
created_at: type: GraphQLString,
course: type: GraphQLString,
scores: type: ScoreType

)
)

const ScoreType = new GraphQLObjectType(
name: "Answer",
fields: () => (
correct: type: GraphQLInt,
answered: type: GraphQLString,

)
)

const RootQuery = new GraphQLObjectType(
name: 'RootQueryType',
fields:
polls:
type: new GraphQLList(PollType),
resolve(parent, args)
return axios.get(POLL_URL)
.then(res => res.data);




)


Here is the query




quiz_data
scores
correct
answered





Here is what it returns




"data":
"quiz_data": [
"correct": null,
"answered": null
]
,
"data":
"quiz_data": [
"correct": null,
"answered": null
]
,











share|improve this question






























    0















    I am writing a GraphQL schema for data with a scores array of different sizes. The data is for quiz scores. The quiz varies in size based on how many people took the quiz.



    When I submit the query, I get null back for "answered" and "correct".



    I want to get back all the scores for each quiz. I wrote the schema with a ScoreType that has the "answered" and "correct" fields. I'm not sure if the schema is the problem or how I am querying the data.



    Here is the JSON file for the quizzes



    [

    "length": "15",
    "average": "77",
    "created_at": "2019-02-01",
    "course": "MATH311",

    "scores": [

    "correct": "12",
    "answered": "14"
    ,

    "correct": "9",
    "answered": "15"

    ]
    ,

    "length": "25",
    "average": "17",
    "created_at": "2019-02-03",
    "course": "MATH301",

    "scores": [

    "correct": "11",
    "answered": "14"
    ,

    "correct": "17",
    "answered": "25"
    ,

    "correct": "20",
    "answered": "22"
    ,

    "correct": "18",
    "answered": "24"

    ]

    ]


    Here is the GraphQL schema



    const Quiz = new GraphQLObjectType(
    name: "Launch",
    fields: () => (
    length: type: GraphQLInt,
    average: type: GraphQLInt,
    created_at: type: GraphQLString,
    course: type: GraphQLString,
    scores: type: ScoreType

    )
    )

    const ScoreType = new GraphQLObjectType(
    name: "Answer",
    fields: () => (
    correct: type: GraphQLInt,
    answered: type: GraphQLString,

    )
    )

    const RootQuery = new GraphQLObjectType(
    name: 'RootQueryType',
    fields:
    polls:
    type: new GraphQLList(PollType),
    resolve(parent, args)
    return axios.get(POLL_URL)
    .then(res => res.data);




    )


    Here is the query




    quiz_data
    scores
    correct
    answered





    Here is what it returns




    "data":
    "quiz_data": [
    "correct": null,
    "answered": null
    ]
    ,
    "data":
    "quiz_data": [
    "correct": null,
    "answered": null
    ]
    ,











    share|improve this question


























      0












      0








      0








      I am writing a GraphQL schema for data with a scores array of different sizes. The data is for quiz scores. The quiz varies in size based on how many people took the quiz.



      When I submit the query, I get null back for "answered" and "correct".



      I want to get back all the scores for each quiz. I wrote the schema with a ScoreType that has the "answered" and "correct" fields. I'm not sure if the schema is the problem or how I am querying the data.



      Here is the JSON file for the quizzes



      [

      "length": "15",
      "average": "77",
      "created_at": "2019-02-01",
      "course": "MATH311",

      "scores": [

      "correct": "12",
      "answered": "14"
      ,

      "correct": "9",
      "answered": "15"

      ]
      ,

      "length": "25",
      "average": "17",
      "created_at": "2019-02-03",
      "course": "MATH301",

      "scores": [

      "correct": "11",
      "answered": "14"
      ,

      "correct": "17",
      "answered": "25"
      ,

      "correct": "20",
      "answered": "22"
      ,

      "correct": "18",
      "answered": "24"

      ]

      ]


      Here is the GraphQL schema



      const Quiz = new GraphQLObjectType(
      name: "Launch",
      fields: () => (
      length: type: GraphQLInt,
      average: type: GraphQLInt,
      created_at: type: GraphQLString,
      course: type: GraphQLString,
      scores: type: ScoreType

      )
      )

      const ScoreType = new GraphQLObjectType(
      name: "Answer",
      fields: () => (
      correct: type: GraphQLInt,
      answered: type: GraphQLString,

      )
      )

      const RootQuery = new GraphQLObjectType(
      name: 'RootQueryType',
      fields:
      polls:
      type: new GraphQLList(PollType),
      resolve(parent, args)
      return axios.get(POLL_URL)
      .then(res => res.data);




      )


      Here is the query




      quiz_data
      scores
      correct
      answered





      Here is what it returns




      "data":
      "quiz_data": [
      "correct": null,
      "answered": null
      ]
      ,
      "data":
      "quiz_data": [
      "correct": null,
      "answered": null
      ]
      ,











      share|improve this question
















      I am writing a GraphQL schema for data with a scores array of different sizes. The data is for quiz scores. The quiz varies in size based on how many people took the quiz.



      When I submit the query, I get null back for "answered" and "correct".



      I want to get back all the scores for each quiz. I wrote the schema with a ScoreType that has the "answered" and "correct" fields. I'm not sure if the schema is the problem or how I am querying the data.



      Here is the JSON file for the quizzes



      [

      "length": "15",
      "average": "77",
      "created_at": "2019-02-01",
      "course": "MATH311",

      "scores": [

      "correct": "12",
      "answered": "14"
      ,

      "correct": "9",
      "answered": "15"

      ]
      ,

      "length": "25",
      "average": "17",
      "created_at": "2019-02-03",
      "course": "MATH301",

      "scores": [

      "correct": "11",
      "answered": "14"
      ,

      "correct": "17",
      "answered": "25"
      ,

      "correct": "20",
      "answered": "22"
      ,

      "correct": "18",
      "answered": "24"

      ]

      ]


      Here is the GraphQL schema



      const Quiz = new GraphQLObjectType(
      name: "Launch",
      fields: () => (
      length: type: GraphQLInt,
      average: type: GraphQLInt,
      created_at: type: GraphQLString,
      course: type: GraphQLString,
      scores: type: ScoreType

      )
      )

      const ScoreType = new GraphQLObjectType(
      name: "Answer",
      fields: () => (
      correct: type: GraphQLInt,
      answered: type: GraphQLString,

      )
      )

      const RootQuery = new GraphQLObjectType(
      name: 'RootQueryType',
      fields:
      polls:
      type: new GraphQLList(PollType),
      resolve(parent, args)
      return axios.get(POLL_URL)
      .then(res => res.data);




      )


      Here is the query




      quiz_data
      scores
      correct
      answered





      Here is what it returns




      "data":
      "quiz_data": [
      "correct": null,
      "answered": null
      ]
      ,
      "data":
      "quiz_data": [
      "correct": null,
      "answered": null
      ]
      ,








      javascript node.js express graphql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 20:17







      jhaywoo8

















      asked Mar 23 at 19:36









      jhaywoo8jhaywoo8

      1781512




      1781512






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Solved it myself. Instead of doing this..



          scores: type: ScoreType


          you have to wrap ScoreType in GraphQLList like this ..



          scores: type: GraphQLList(ScoreType)





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55317617%2fgraphql-query-returning-null-fields%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Solved it myself. Instead of doing this..



            scores: type: ScoreType


            you have to wrap ScoreType in GraphQLList like this ..



            scores: type: GraphQLList(ScoreType)





            share|improve this answer



























              0














              Solved it myself. Instead of doing this..



              scores: type: ScoreType


              you have to wrap ScoreType in GraphQLList like this ..



              scores: type: GraphQLList(ScoreType)





              share|improve this answer

























                0












                0








                0







                Solved it myself. Instead of doing this..



                scores: type: ScoreType


                you have to wrap ScoreType in GraphQLList like this ..



                scores: type: GraphQLList(ScoreType)





                share|improve this answer













                Solved it myself. Instead of doing this..



                scores: type: ScoreType


                you have to wrap ScoreType in GraphQLList like this ..



                scores: type: GraphQLList(ScoreType)






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 20:27









                jhaywoo8jhaywoo8

                1781512




                1781512





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55317617%2fgraphql-query-returning-null-fields%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현