Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-26-2020 06:01 PM
Hi all
I am trying to design my own project and was curious about something once I finished design. So initially My system had the follwoing two relationships going on
(User) -[LIVES_AT]->(Address)-[HASZIP]->Zipcode
(Clubs) -[LOCATED_AT]->(Address)-[HASZIP]->Zipcode
After the first iteration I figured I should remove the address node entirely(it had no properties in it that I really wanted to keep). So now I want it something like
(User) -[HASZIP]->Zipcode
(Clubs) -[HASZIP]->Zipcode
So here is the question part. When writing a typedef for this realtionship, I want the api to allow user to be null or club to be null but not both. Is there a way to achieve this?
type HAS_ZIP @relation(name: "HAS_ZIP"){
id:ID!
user: User(not sure?)
club: Club(not sure?)
zipcode : ZIPCode!
}
Solved! Go to Solution.
09-27-2020 10:21 AM
Hi, I don't know abou typedef but you could use the constraints o created a query that get both relations a compare if is null.
Thanks
09-27-2020 10:21 AM
Hi, I don't know abou typedef but you could use the constraints o created a query that get both relations a compare if is null.
Thanks
09-27-2020 02:46 PM
Oh ye that makes sense. Do you guys have any sample projects that make use of contraints ?
Thanks again for the help
10-04-2020 04:35 PM
Hi
You can see info about constrainsts here:
Thanks
All the sessions of the conference are now available online