Back

How to create Arrays of attribute inside an attribute

  • 0
  • Flutter
  • Web
  • Android
  • Tools
  • Apple
Areeb Ahmad
2 Jun, 2024, 11:27

Hai i am new with appwrite i want to create a structure like

{ "user_name": "test", "age": 100, "ishuman": false, "orders": [ { "order_id": 90909, "item_name": "alien food", "item_price": 789 } ] }

i cam create others attributes but how to create orders attribute

TL;DR
Developers can't create arrays inside attributes. Instead, they should create a separate collection for related items like "orders" to establish relationships.
D5
2 Jun, 2024, 11:32

You should create an orders collection

Areeb Ahmad
2 Jun, 2024, 11:42

I have already created but i can add it which attribute to choose ?

D5
2 Jun, 2024, 11:44

What do you mean?

D5
2 Jun, 2024, 11:44

You can't have an attribute inside an attribute

D5
2 Jun, 2024, 11:44

Alternatively you can have relationships between collections or use foreign keys

Areeb Ahmad
2 Jun, 2024, 11:45

{ "user_name": "test", "age": 100, "ishuman": false, "orders": [ { "order_id": 90909, "item_name": "alien food", "item_price": 789 } ] }

so this is not possible ?

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