[SOLVED] the cloud document creation doesn't register my relationships inside it
- 0
- Databases
- Web
- Cloud
Yeah i just found out the problem is with the relationships if they have the same items in them it will not create another order it will replace the order that has been created, can u suggest me anyways to fix this?
What are the relationship attributes and what are the relationship types?
The orders have a relation of one to many to items and one to one to address, and the itemBlocker has a one to one relation to order and item
Should i send a picture of the collection attributes?
it will replace the order that has been created
Also, what do you mean by this?
orders have a relation of one to many to items
two way?
One way
Well I’m the first time seeing this but when i createDocument in orderResult for the second run it will throw that error. Document with that ID already exists. Like it’s creating a document
do you have any unique indexes?
No I don’t.
I just tried to do something like:
const orderResult = await database.createDocument("654b2f6a8af9b2ed391f", "6564217c78122dc22f6f", ID.unique(), orderRequest);
and it worked fine...
What API call exactly is failing?
Does it have a relation in it?
try {
const result = await Appwrite.functions.createExecution(
"6566e3017ed5ff75b429",
JSON.stringify(order),
false,
"/",
"POST"
);
console.log("Executed");
console.log(result);
} catch (e) {
console.log(e);
throw e;
}
}
i'm calling this function
id?: string | null;
userId: string;
items: RequestSelectedItems[];
}
interface RequestSelectedItems{
itemId: string;
quantity: number;
}```
this is the model of order i'm sending
example like this i just created an order with two items inside it, then created another order with the same two item inside it it just stole the items inside it from the previoues order.
ohhhhh actually, i was able to reproduce...
soo i think it's because it's a one to many relationship. Regardless of it being only 1 way, an item can only be linked to 1 order. You may need to use a many to many relationship
Yesss thank you so much, it fixed it . But is this a problem with appwrite or just how sql works?
I think it's behaving as designed
Thank you so much
[SOLVED] the cloud document creation doesn't register my relationships inside it
internal server when i am trying to create a new document async addProduct(prodData) { try { return await this.databases.createDocument( conf.appwriteDatabaseId, conf.appwriteCollectionId, ID.unique(), prodData ); } catch (error) { console.log("databaeService::addproduct::error: " + error); } }
check permissions for related collections
Recommended threads
- Project is currently blocked
When accessing the Appwrite console, I receive the message: "Project is currently blocked. Access to this project is restricted. Contact support if the issue pe...
- Does 1.9.0 Self Hosted have MongoDB Atla...
I have been playing with the new 1.9.0 update and I am really excited for the MongoDB support. I wanted to ask though if at the current time Appwrite supports b...
- {"code": 1008, "message": "Invalid Origi...
Nothing has changed in my application or console settings so I'm curious as to what I need to do to fix this. I already have the client registered so I'm not en...