Back

[SOLVED] looking for somehelp in relationships,

  • 0
  • Databases
  • Web
ddet2022
12 Jun, 2023, 22:06

each order will have multiple Products

TL;DR
The user was looking for help with relationships in their app. They initially tried using JSON.stringify, which worked but they were looking for a better solution. They wanted to have objects in a string array. Another user suggested creating a profiles collection and using database relationships with that collection. The original user mentioned that they couldn't create new attributes for Auth and wanted to know how to create a relationship with a user(Auth) and a collection. It was suggested that they create a collection for order items and have an array of IDs in the orders collection, but the original user preferred using an array of objects. No solution was provided for this preference.
ddet2022
12 Jun, 2023, 22:06

so i thought of using array of objects

Drake
12 Jun, 2023, 22:08

Right so have a collection of order items. And in the orders collection you'd have an array of IDs (strings)

ddet2022
13 Jun, 2023, 08:01

will array of objects supported in future release?

Drake
13 Jun, 2023, 14:44

most likely not especially since we have relationships in the latest bersion of Appwrite

ddet2022
13 Jun, 2023, 17:13

How can i create a relationship for a user(Auth) with collection,

ddet2022
13 Jun, 2023, 17:14

Unable to create new attributes for Auth

Drake
13 Jun, 2023, 17:49

I would suggest creating a profiles collection for any user related data you want to use in your app. then you can use database relationships with that collection (assuming you're on Appwrite version 1.3.x)

ddet2022
13 Jun, 2023, 19:23

yes. I am using 1.3.7

ddet2022
13 Jun, 2023, 19:24

i dont see any option to create a releationship with Auth collection, I am using the email and password authentication

ddet2022
13 Jun, 2023, 19:26
ddet2022
13 Jun, 2023, 19:26

i am seeing only Products and Orders collection

ddet2022
13 Jun, 2023, 19:26

I expected to see Authentication collection

ddet2022
13 Jun, 2023, 19:28

I have collection called userProfiles, i want to make a relationship with Auth

Drake
13 Jun, 2023, 19:39

You can't make a relationship with the Auth service.

ddet2022
13 Jun, 2023, 19:40

ok, so copy the $id from AuthService and keep it in UserProfile

Drake
13 Jun, 2023, 19:40

I typically use the same user Id as the document ID in my user profiles collection

ddet2022
13 Jun, 2023, 19:41

Sure.. That helps

ddet2022
13 Jun, 2023, 19:41

Thanks Steven

Guille
13 Jun, 2023, 20:33

Is your issue solved @ddet2022 ?

ddet2022
13 Jun, 2023, 20:57

yes, but i am looking for better solution for initial problem. how to have objects in sting array[]

ddet2022
13 Jun, 2023, 21:12

I have tried JSON.stringify, it worked.

ddet2022
13 Jun, 2023, 21:13

Sounds like the issue is fixed, thanks for your help

ddet2022
13 Jun, 2023, 21:13

appreciate your support.. Impressed

Guille
13 Jun, 2023, 21:33

[SOLVED] looking for somehelp in relationships,

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