-
Notifications
You must be signed in to change notification settings - Fork 9
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
Target collection params in query #57
Comments
On the face of it, this seems difficult to achieve. Leaving issue open for a little while though... |
I guess this would help with replacing a trigger such as: export const onDeleteUser = db.document('users/{userId}').onDelete(async (user, _) => {
const batch = firestore().batch();
//delete all comments
const comments = await user.ref.collection(`comments`).get();
comments.forEach(({ ref }) => batch.delete(ref));
await batch.commit();
}); Seems like a basic thing to be able to do: delete a subcollection on deletion of parent |
I think adding the below code next to this line enables setting the wildcarded parameters in the target collection as needed:
@nbransby would it be possible for you to add it to the library? This will enable using nested collections in such cases without the need of creating group collection index - this will save extra indexes which is helpful since there is a limit on the number of such indexes in firestore. I guess the same can be applied to the |
Would it be possible to use the parameters from the source collection in the target collection? I was thinking of being able to use the parameters in the source to the target collection.
Very basic example but the idea to use the
someId
in the target collection query.The text was updated successfully, but these errors were encountered: