Unique Indexes on predicates

Hi

Dgraph now supports transactions! So all of the above can now be done using them.

If you want to assert a unique index, you would:

  1. Create a transaction (this is done locally) by the client
  2. Send a query (via the transaction) to check if the predicate value already exists
  3. If it does, abort. If it doesn’t send a mutation to add the key as part of the transaction.
  4. Commit the transaction. Dgraph will abort if the query/mutation is no longer valid.

You can find out how to create a transaction for your given client on the client docs.

EDIT: you can read more about transactions here: Releasing distributed transactions in v0.9 - Dgraph Blog