How can we store response of Graphiql Api into MongoDB?

92
August 27, 2021, at 9:40 PM

This is my example Schema

orders:{
    id,
    customer:{
    name,
    email,
    phone
    }
    lineItem:[{
    id,
    title,
    sku,
    price,
    qty
    }],
    paymentStatus
}

This is my Reset Api Response and I used to store this response in mongoDb:

{
    id:ab163,
    customer:{
    name:'john',
    email:'john@gmail.com',
    phone:123456,
    }
    lineItems:[{
    id:p64a8,
    title:'iphone 6',
    sku:'apple1_6',
    price:100,
    qty:1
    }]
    paymentStatus:'paid'
}

GraphQl Response Example

orders:{
    edges:[{
    node:{
    id:ab163,
    customer:{
    name:'john',
    email:'john@gmail.com',
    phone:123456,
    }
    lineItems:[{
    id:p64a8,
    title:'iphone 6',
    sku:'apple1_6',
    price:100,
    qty:1
    }]
    paymentStatus:'paid'
}}]

This is third party GraphQl Api response.The problem is that structure of this response is different from Rest-Api response.This GraphQl response includes keywords like edges and node. I am confused how I would be storing this GraphQl response in mongoDB. Do I need to re-wirte or modify mongoDb Schema or is there a way that I can store this GraphQl response in the same way as I stored RestApi response in mongoDb without changing model Schema.

Rent Charter Buses Company
READ ALSO
Handling card overflow text

Handling card overflow text

I have this card container to display some text that is overflowing

46
How can I submit a form from JavaScript?

How can I submit a form from JavaScript?

I have a form with 2 buttons and would like to display a jQuery Dialog when a button is clickedWhen clicking on a button (say 'Yes') which is displayed on the jQuery Dialog, I'd like to execute a Drupal handler

101
Cloud SQL : can a read replica serve for HA

Cloud SQL : can a read replica serve for HA

I'm confused about the ability of read replicates to serve HA, from this doc we have :

71