ही तीन operation types आहेत, प्रत्येक schema मधील एका root type शी मॅप केलेली:
ही तीन operation types आहेत, प्रत्येक schema मधील एका root type शी मॅप केलेली:
query GetPost { # read
post(id: "1") { title }
}
mutation AddComment { # write; returns the created object so the client updates its cache
addComment(postId: "1", text: "Nice!") {
id
text
}
}
subscription OnComment { # live: fires every time a comment is added
commentAdded(postId: "1") {
id
text
}
}
Mutations arguments घेतात (बहुधा एक input object) आणि त्यांनी प्रभावित झालेला data परत करावा जेणेकरून client दुसऱ्या request शिवाय refresh करू शकेल. क्रमवार नियम महत्त्वाचा आहे: एका document मधील दोन mutations — आधी deposit मग withdraw — नेहमी त्याच क्रमाने चालतात, तर दोन query fields एकाच वेळी concurrently resolve होऊ शकतात.
Interviewers हे तपासतात की तुम्हाला माहीत आहे का की queries समांतर व side-effect-free असतात तर mutations क्रमवार असतात, आणि subscription साठी stateful transport (WebSocket/SSE) लागते. Mutation मधून updated data परत करणे हा तो व्यावहारिक तपशील आहे जो GraphQL प्रत्यक्ष ship केलेल्या लोकांना फक्त त्याबद्दल वाचलेल्यांपासून वेगळे करतो.
सविस्तर उत्तरांसह IT मुलाखत प्रश्नांचे ग्रंथालय — Junior पासून Senior पर्यंत.
देणगी द्या