cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Creating a relationship between two nodes but the second node can have any of two predefined labels in neo4j-graphql-js

Suppose I want to define a relationship like the following :

a:University -[ENTRY]-> b:Department 
OR
a:University -[ENTRY]-> p:Position

How to do this with neo4j-graphql-js ?

4 REPLIES 4

My main recommendation would be to use properly descriptive relationship-types.

Otherwise you can use two custom mutations that use a @cypher directive for creating either of these.

Okay, let's say I defined the two mutations as below,
addPositionEntry()
addDepartmentEntry()

Now coming back to GraphQL schema level,

University{
    entry: // Here I want the relationship data to come whether it's from addPositionEntry or addDepartmentEntry
}

How should I do this?

This post is old. Were you able to figure out how to do this?
I found https://github.com/thepiperpied/palm-tree/blob/b1d16ac52950a220bdfde60fd25b760a6f58e9d5/graphql-sche... from other post but how do I send both objects as argument instead of ids?

In the new version of graphql-neo4j-js library it has been resolved. @npatel