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
Counting length of a hasMany relationship in v3 #587
Comments
+1 I have the same issue here: #586 |
This would fetch the data, which is unoptimal. I'd suggest this solution: https://github.com/firebase/functions-samples/tree/master/child-count Increment/decrement a child count on the server-side on child addition/deletion with Cloud Functions. |
@jamesdaniels but it doesn't fetch the data in the v2 version? That was the neat part. No need for any extra cloud function per relationship. Appreciate the suggestion anyway! |
That was because in v2 the realtionship's ids were embedded on the document. Which led to many many other problems :P The child count Cloud Function is the correct path, after all v2 was created before we had Cloud Functions, and our new Distributed Counter Extension handles this same problem at scale (> 1 counter increment / second sustained). |
Hi, in v2 you could do
to get the length of a relationship from the keys without having to fetch them. In vEmberfire v3 it returns an empty array
[]
, even when the relationship is loaded.Is there an equivalent or smarter way in Emberfire v3? Thanks!
The text was updated successfully, but these errors were encountered: