You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create two collections: Assembly & Part (or whatever you like)
Create a two-way parent-child relationship between the collections. Inside Assembly:
i. Attribute Key:parts
ii. Attribute Key (related collection):assembly
iii. Relation: one-to-many
iv. Ensure to set the "on delete" behaviour to "Set document id to NULL in all related documents"
Write some code using the web SDK to subscribe to the documents channel for the Assembly collection only (databases.*.collections.assembly.documents)
Testing
Use createDocument in the SDK to create an Assembly
Use updateDocument in the SDK on the Assembly created above to add a new Part document, which creates the association for you
Observe that the promise for the Assembly is called (as expected) when the association was created
Observe in the Appwrite UI that the documents exist and have the data provided
Now, use deleteDocument in the SDK on the Part above, to remove the part and the association from Assembly
Observe that the promise for the Assemblyis not called
Observe in the Appwrite UI that the Part no longer exists and the association in Assembly is gone
👍 Expected behavior
✅ Real-time should send a payload update for Assembly when the association is created
✅ Real-time should send a payload update for Assembly when the association is deleted
👎 Actual Behavior
✅ Real-time should send a payload update for Assembly when the association is created
❌ Real-time should send a payload update for Assembly when the association is deleted
🎲 Appwrite version
Version 1.4.x
💻 Operating system
Linux
🧱 Your Environment
Appwrite is self-hosted with docker-compose in a virual machine on Ubuntu 22.04.
Appwrite Version: 1.4.1 Appwrite SDK: web
👀 Have you spent some time to check if this issue has been raised before?
For those who might be searching issues for something similar, a workaround I've devised is to add a Datetime field named touch on the parent object (in this case, Assembly) that I also update to be a new Date() immediately after removing associations.
This isn't ideal, but allows me to receive the updated parent object with the association removed as I'd expect.
👟 Reproduction steps
Setup
Assembly
&Part
(or whatever you like)two-way
parent-child relationship between the collections. InsideAssembly
:i. Attribute Key:
parts
ii. Attribute Key (related collection):
assembly
iii. Relation: one-to-many
iv. Ensure to set the "on delete" behaviour to "Set document id to NULL in all related documents"
documents
channel for theAssembly
collection only (databases.*.collections.assembly.documents
)Testing
createDocument
in the SDK to create anAssembly
updateDocument
in the SDK on theAssembly
created above to add a newPart
document, which creates the association for youAssembly
is called (as expected) when the association was createddeleteDocument
in the SDK on thePart
above, to remove the part and the association fromAssembly
Assembly
is not calledPart
no longer exists and the association inAssembly
is gone👍 Expected behavior
✅ Real-time should send a payload update for
Assembly
when the association is created✅ Real-time should send a payload update for
Assembly
when the association is deleted👎 Actual Behavior
✅ Real-time should send a payload update for
Assembly
when the association is created❌ Real-time should send a payload update for
Assembly
when the association is deleted🎲 Appwrite version
Version 1.4.x
💻 Operating system
Linux
🧱 Your Environment
Appwrite is self-hosted with docker-compose in a virual machine on Ubuntu 22.04.
Appwrite Version: 1.4.1
Appwrite SDK: web
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: