#random

Handling Orphaned Records in Firebase Extension with Typesense

TLDR David raised a concern about Typesense records not being deleted when parent collections are removed. Jason confirmed that Firestore does not trigger delete events for individual documents when parent collections are dropped.

Powered by Struct AI

1

1

4
3mo
Solved
Join the chat
Jun 28, 2023 (3 months ago)
David
Photo of md5-7621a536ac5e9f5ac6d4713602bef5fd
David
05:47 PM
Hey all, could use a confirmation on something:

• I'm using the firebase extension with a forked cloud function to index records from firestore to typesense
• I'm monitoring a nested firebase sub-collection with the path collection1/{wildcard1}/collection2/{wildcard2}/collection3
• In some of our tests, we prop up test collections, add values, and tear down by removing collection1
• After removing the parent collection1 typesense records from collection3 are not being deleted, and they're building up very quickly in our dev cluster
I read somewhere that this may require another firebase cloud function that removes orphaned records from typesense when one of their parent collections is deleted from firestore. Is this the correct approach?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:58 PM
Yeah the extension does not delete collections.
05:58
Jason
05:58 PM
It responds to delete events for individual documents
05:59
Jason
05:59 PM
I don’t think Firestore triggers individual document delete events when the parent collection is dropped

1

1