DEV Community

Discussion on: Building a GraphQL API on AWS with Amazon Neptune Graph Database and CDK

Collapse
 
muhammadtayyab1 profile image
Muhammad Tayyab

Hi sir! can you make the edge between two posts by using id or custom Id, am stuck a project about last 3months and am not able to add edges between them by using custom id.

i will try to add person first and add custom id like personID=1 or 2.. and similar for person two by using personID= 2, or something in number so problem is that when i call the mutation like create edge between them by using label friend by typing person1ID and person2ID then error occur ,this is the code:

async function addFoF(friend: Friend) {
try {
await g.V().has('Person', 'personID',friend.person1ID).addE("Friends").
to(__.V().has("Person", 'personID', friend.person2ID')).toList()

    return { success: "Friend Added" }
} catch (error) {

    return { error: 'Error While adding friends' }
}
Enter fullscreen mode Exit fullscreen mode

}
mutation is just addFoF(person1ID: String!, person2ID: String!): String!

please help me to solve this..

Collapse
 
cybermischa profile image
Mischa Spiegelmock

The docs on npmjs.com/package/gremlin show how to define a custom ID