2

I have a GraphCool model called Student which has a field called studentNumber. How can I prevent two (or more) different Student nodes with the same studentNumber? In SQL databases I was able to create a unique index to accomplish this.

Alan Hamlett
  • 3,160
  • 1
  • 23
  • 23

1 Answers1

2

The easiest way to do so is by enabling the "Unique" constraint for a certain field (studentNumber in your case for the Student model). You can enable constraints in the structure view when editing a model.

Note: Under the hood, this creates a unique index in the database just like you suggested.

schickling
  • 4,000
  • 4
  • 29
  • 33