Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support backfill documents in subcollections #17

Open
eysenshi opened this issue Aug 27, 2021 · 6 comments
Open

Support backfill documents in subcollections #17

eysenshi opened this issue Aug 27, 2021 · 6 comments

Comments

@eysenshi
Copy link

Description

This is a request to support backfill all subcollections return from a collection group query. This could be helpful in use case like, backfill landmarks data from all cities under path: cities/{cityId}/landmarks.

@jasonbosco
Copy link
Member

Note to myself: docs for listening on dynamic paths: https://firebase.google.com/docs/functions/firestore-events#wildcards-parameters

@elhe26
Copy link

elhe26 commented Dec 13, 2021

@jasonbosco, this extension supports subcollection paths? (ie. cities/{cityId}/landmarks)

@ChauCM
Copy link

ChauCM commented Dec 14, 2021

Subcollection like "cities/{cityId}/landmarks" worked for me on indexToTypesenseOnFirestoreWrite but not on backfill: backfillToTypesenseFromFirestore. Basically the backfill function runs without error but no record is imported.

@guenth39
Copy link

guenth39 commented Apr 20, 2023

@jasonbosco Any plans to implement this? I would really need this feature!

@guenth39
Copy link

The issue should be fixed by changing this line in the backfill cloud function

const querySnapshot =
await admin.firestore().collection(config.firestoreCollectionPath).get();

In the case of a subcollection, we have to use collectionGroup instead of collection.

@jsasitorn
Copy link
Contributor

Added a PR that adds support for this in #99 with additional checks on the collection path. Concern with a quick .collectionGroup("landmarks") approach in backfill is that it may accidentally capture unrelated entities. So you not only get "cities/{cityId}/landmarks" but also "towns/{townId}/landmarks"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants