Back

Array of Map attribute.

  • 1
  • Android
  • Flutter
  • Databases
Drake
20 Oct, 2023, 18:25

Appwrite is more like a relational database than a NoSQL database. I do not suggest creating a collection like this because you may run into problems querying data or adding/removing addresses.

I highly recommend creating a collection per data type. Then, you can either use relationships (keep in mind it's still experimental) or manually put the document ids as strings

TL;DR
The user wants to know if they can have an array of map attributes in their database. The support team advises against it and recommends creating a collection per data type instead. They mention that Appwrite is more like a relational database and suggest using relationships or manually adding document ids as strings.
jesuswithBigD
20 Oct, 2023, 18:40

An example of this is a client whose data is:

Order number: name: payment method: Address: city, street, home address, Its location is on Google Map. Products ordered: Total:

jesuswithBigD
20 Oct, 2023, 18:40

Do i have to create a collection per data type for all of these.

VincentGe
20 Oct, 2023, 18:44

No these would live in one collection

VincentGe
20 Oct, 2023, 18:44

You'd create an attribute for each of these with the appropraite data type

jesuswithBigD
20 Oct, 2023, 18:47

I was hoping if I can mush all of these into one array of map, but I can't.

VincentGe
20 Oct, 2023, 18:47

Why do you want all of these into one array map?

VincentGe
20 Oct, 2023, 18:47

Do you not need to query them?

VincentGe
20 Oct, 2023, 18:48

If you don't need to query this data, you can just use a giant serialized JSON stirng.

If you need to query them, they should be documents in a collection πŸ™‚

jesuswithBigD
20 Oct, 2023, 18:49

This future is in firebase and I'm used to using it.

jesuswithBigD
20 Oct, 2023, 18:51

😁

VincentGe
20 Oct, 2023, 18:51

πŸ˜„ We're not a NoSQL db heeheee

VincentGe
20 Oct, 2023, 18:52

I understand where you're coming from tho

VincentGe
20 Oct, 2023, 18:52

haha

VincentGe
20 Oct, 2023, 18:52

If you need to query, should be attributes in a collection/

jesuswithBigD
20 Oct, 2023, 18:52

I'm sadπŸ˜”

VincentGe
20 Oct, 2023, 18:52

If you don't need to query, serialize it and stick it in a String

jesuswithBigD
20 Oct, 2023, 18:52

Ok i will try this.

VincentGe
20 Oct, 2023, 18:53

If you only lookup by user, you cand have a giant array of strings for orders under the user

jesuswithBigD
20 Oct, 2023, 18:54

Ok, thanks.

VincentGe
20 Oct, 2023, 18:55

At least you won't have query times in the hundreds of millisecond range for searching a few strings πŸ˜‰

VincentGe
20 Oct, 2023, 18:55

We may add a multi-model DB in the future, support NoSQL like DBs in the future

VincentGe
20 Oct, 2023, 18:55

Also keep your eyes peeled for that πŸ˜„

VincentGe
20 Oct, 2023, 18:55

We're still early stages

jesuswithBigD
20 Oct, 2023, 18:57

<:appwritefire:823999000330895380> <:appwritefire:823999000330895380>

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