I have a Mutation resolver that I want to return a Branch type
type Branch {
ID: ID!
Parent: Node
Child: Node
item: Int
}
The Server works fine, but the output is not the correct shape
Mutation: {
async RemoveBranch (parent, args, ctx, info) {
let session = ctx.driver.session();
let query ='MATCH.....
.
.
return branch{Parent, .ID, .item, Child} as Branches'
async RemoveBranch (parent, args, ctx, info) {
return session.run(query, args)
.then( result => {
const Branches = result.records.map(record => { return record.get("Branches")})
console.log(result)
return Branches
})
},
}
console.log(result) gives me the following in the server terminal window
{
item: 6,
ID: 'eb86aa67-7264-4d19-921b-4324ef7fda45',
Parent: Node { identity: 159, labels: [Array], properties: [Object] },
Child: Node { identity: 87, labels: [Array], properties: [Object] }
},
{
item: 9,
ID: '601579ea-0587-4c4b-8524-d923b4d579e6',
Parent: Node { identity: 159, labels: [Array], properties: [Object] },
Child: Node { identity: 95, labels: [Array], properties: [Object] }
}
The Parent and Child Node objects are included in the output but it seems I need to do something else to coax the properties out.
So how do I turn this:
Parent: Node { identity: 159, labels: [Array], properties: [Object] },
Into this?
Parent: {ID:"a78667e5-e3a7-462b-a7bd-76d6fad629f2",name:"Some Node name"}
Thank you.