Back

[SOLVED] how to make an attribute unique in appwrite

  • 0
  • Users
  • Accounts
  • Databases
Ansh
22 Sep, 2023, 14:24

i want to make a filed unique for eg username in a social media app how to make this field unique in appwrite

TL;DR
Solution: To make an attribute unique in Appwrite, you need to add a unique index to that attribute. Check the Appwrite documentation for indexes types (<https://appwrite.io/docs/databases#indexes>) and follow the steps mentioned there. This will ensure that any value inside that attribute is unique. In the case of making a username field unique in a social media app, you can add a unique index to the username attribute in the Appwrite collection.
Binyamin
22 Sep, 2023, 14:24

In a given collection?

Ansh
22 Sep, 2023, 14:26

yes

Binyamin
22 Sep, 2023, 14:27

Add a unqiue index to that attribute

Binyamin
22 Sep, 2023, 14:27

This will make sure any value inside that attrubite will be unqiue

Ansh
22 Sep, 2023, 14:27

ok

Binyamin
22 Sep, 2023, 14:29

Check Appwrite indexes types

Drake
22 Sep, 2023, 18:15

[SOLVED] how to make an attribute unique in appwrite

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more