Back

[SOLVED] How do I store list of maps in appwrite database?

  • 1
  • Databases
Prince Raj
19 Mar, 2023, 03:30

I have a attribute items in my database and i want to store a list of Item objects which includes name, ID and price... I'm not able to figure out how do I achieve this with appwrite database

TL;DR
The user wanted to know how to store a list of maps in an Appwrite database. They learned that it is recommended to create a collection for each object type and to have a separate collection for items. They were unsure how to link the items collection to the order it belongs to. It was suggested to create a separate database only if necessary and to create an attribute for items in the orders collection. Finally, the user wanted to know how to store a list of Item objects with attributes such as name, ID, and price. No solution was provided for this specific question.
Drake
19 Mar, 2023, 03:32

The best approach is to make a collection for those items

Prince Raj
19 Mar, 2023, 03:35

The database servers us in this way: Database > Collection > Document My database is 'orders' for storing all the all the orders, so each order will be a collection storing the necessary details, such as order ID, username, phone, address, items.. How can I create a collection inside a document?

Drake
19 Mar, 2023, 03:36

In general, I recommend having a collection per object type. I would only create separate databases if there was some specific reason

Prince Raj
19 Mar, 2023, 03:38

You're telling me to create another collection for items, i got it.. But how I'll link it with the order of which the items( stored in the items collection)?

Drake
19 Mar, 2023, 03:40

Have an order ID attribute in items

Prince Raj
19 Mar, 2023, 03:43

Hmm...Okay.. and while fetching the list of documents, I can filter it out by querying the Order ID... For that i need to add create index for the order id, right?

Prince Raj
19 Mar, 2023, 03:44

Got it, Thank you for the help 😊

Prince Raj
23 Mar, 2023, 07:13

[SOLVED] How do I store list of maps in appwrite database?

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