Getting information about child fields as arguments in the parent using apollo-server

I am currently utilizing apollo-server and am curious if there is a method to obtain information (the fourth argument of a resolver) as it would be received by a specific child field, but within the parent resolver of that child field.

My scenario is as follows: I have a mutation called edit_x with two fields 'before' and 'after'. I must resolve the 'before' field prior to executing the mutation, so resolution needs to occur in the parent. I rely on a library named joinmonster for resolving my graphql requests that interact with the database, and this library requires the information of a field to complete the resolution. However, what I require is not the information of 'edit_x', but rather the information of 'before'.

Thank you very much

Answer №1

When the resolver is called for a field in GraphQL, it receives a GraphQLResolveInfo object specific to that field. This object is only built right before the resolver is executed. You can find more information in the source code here. Keep in mind that parent fields are resolved before child fields, so it's not possible to achieve what you're trying to do.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Automatically showcase images from a directory upon webpage loading

Is there a way to modify my code so that the images from the first directory are displayed on the page when it loads, instead of waiting for a menu option to be clicked? The page looks empty until a menu option is selected, and I would like the images to s ...

What is the best way to retrieve the contents of the first and second lines from a textarea input field?

I'm seeking a way to extract the content of the first and second lines from a textarea in HTML. The challenge lies in the fact that the first and second lines may have varying lengths, making it impossible to simply copy a set number of characters. ...

The useEffect hook is not successfully fetching data from the local db.json file

I'm attempting to emulate a Plant API by utilizing a db.json file (with relative path: src\plant-api\db.json), and passing it from the parent component (ItemList) to its child (Item) but I am facing an issue where no data is being displayed ...

A guide on scheduling automatic data insertion in mongoose.js

I'm working on a website with Node.js and Mongoose, and I could use some guidance on how to automatically insert data into Mongoose with Node.js at specific times. For example, at the end of each month, I want my current data to be stored in the Mongo ...

Basic click event triggered every second click in JavaScript and HTML

onclick="HandleAction(\'playnow\');HandleAction(\'stop\');" This element performs two functions simultaneously. However, it only executes the actions \playnow\ and then \stop\ immediately after. ...

Retrieving search results in JSON format from a website with NodeJs

I recently started learning Node and attempted to retrieve a website's search result in JSON format using Node. I experimented with the HTTP chunk method and Express GET, but unfortunately, was unable to find a solution. The specific URL I was working ...

Scraping data from a webpage using Node.js and the Document Object Model

I am attempting to extract information from a specific website using Node.js. Despite my best efforts, I have not made much progress in achieving this task. My goal is to retrieve a magnet URI link which is located within the following HTML structure: < ...

What is the best approach: Loading all database results at once or making multiple requests?

Looking to refine a vast database with these specific columns: Name - Maximum Height - Minimum Height - Range - Maximum Angle - Minimum Angle The goal is to filter the data based on user-inserted criteria, such as if a user inputs a maximum height of 80c ...

An error occurs when attempting to redirect with getServerSideProps

When I am logged in, I want to redirect to the /chat page using auth0 for authentication. The error seems to be related to returning an empty string for props, but it does not impact the website as redirection works correctly. The main issue here is the in ...

Navigating efficiently with AngularJS directives

Hello, I am currently searching for a solution to dynamically modify the navigation links within the navigation bar based on whether a user is logged in or not. Of course, a logged-in user should have access to more pages. I have developed a UserService t ...

What is the best way to incorporate a new field into an established JSON structure?

I have a JSON data set containing 10,000 unique records and I am looking to add another field with a distinct value to each record. What is the best way to achieve this? [ { _id: "5fffd08e62575323d40fca6f", wardName: "CIC", region: &quo ...

In three.js, a full rotation on the Y axis is not achievable for cubes

My low poly world features gravity added with raycasting to the character. Now, I am looking to incorporate another raycaster in front of the character, specifically the pointer lock controls, to enable walking on non-flat surfaces. This raycaster would al ...

Incorporating Chip into a Material-UI DataGrid column

I'm having trouble displaying data of a specific column inside a chip. I attempted to use the Chip component in my code: StackBlitz Demo Web Link: Live Demo I tried to incorporate it using: import Chip from '@mui/material/Chip'; but c ...

User information in the realm of website creation

Can someone provide insight on where user data such as photos, videos, and posts is stored? I doubt it is saved in an SQL database or any similar system. ...

Looking to customize scrolling behavior when navigating back in Next.js?

I have a function in my index.js file that fetches a list of posts like this: const Index = (props) => { return ( <div> {props.posts.map((each) => { return ( <Link scroll={false} as ...

Is there a way to calculate the word frequency in my text using plain JavaScript?

Welcome to the text entry section: https://i.sstatic.net/VlBvt.png After clicking on the COUNT button, it will direct you to this page: https://i.sstatic.net/sqKWc.png I can see my entered text and word count displayed. Now I'm curious, how can I ...

Is there a way to target a sibling element of another element by using its identifier in Cypress?

My current task involves clicking a checkbox within a list of table rows. The only way I can think of reaching this level is by targeting the span tag along with its corresponding name. cy.get('tr > td > span').contains('newCypressTes ...

What is the method for implementing an 'AND' condition in Firebase or its equivalent?

I have a query requirement where I am looking to display only specific data by using an 'AND' statement or its equivalent. To better explain, I am referencing the example given in the Firebase Documentation. // Find all dinosaurs whose height is ...

Whenever the user hits the "Enter" key, a new element will be generated and added to the bottom of an existing element

I am in need of creating a new element at the end of another element. For instance, let's say I have this element: <div id="elmtobetrig">Element that should be followed by another element when the user hits enter after this text. <! ...

Develop a client-side API utilizing various libraries

After completing the server side of an API that delivers HTML via JSON using REST through CodeIgniter, I am now exploring how to create a client-side API with JavaScript. The goal is to retrieve data from the server through the API, display it in the DOM, ...