-
Notifications
You must be signed in to change notification settings - Fork 45
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
Return counts broken down by attribute from collection #64
Comments
Hey @aaronmyhre, no, it's not really possible to do this right now (unless I guess you know all the I guess PCs would give you some building blocks to do that but it doesn't try at the moment. Do you need this data to be reactive? Perhaps you are just looking for a mongo aggregation.. |
Hey @tmeasday - Ok cool, I thought not, but just wanted to make sure. The data doesn't really need to be reactive. While the user is on the page where these aggregate counts are available, I don't anticipate them changing. If thats the case, it sounds like I either denormalize the counts onto the user data set, or do an aggregation server side in mongo and publish the results as a new collection... I coming from a SQL world, so I am more hesitant about the former option, but it sounds like that is fairly normal in mongo... |
Here's a possible implementation of Concerns
Idea
@aaronmyhre, you're welcome to fork the project and try it out. The code in publish counts is fairly simple. With this example, you'd have to run |
Hey @boxofrox - Very cool, thanks for the outline. I am traveling for the next four or five days, but when I settle down I will give this a whorl and let you know how it goes. |
I have the similar requirement as above, my use case is to count the documents by a user I've managed to achieved the counts of documents per company per branch based on user roles with the help of @boxofrox :) Thanks for that! My requirement is something like this, if the role is What you see on the total enrollments column is actually the total number of documents the company has. I don't know how achieve this requirement, based on @tmeasday , it is not possible at this time. Do you have any workaround for this? |
@Ajaxsoap. I have an idea on this, but I'd rather not hijack @aaronmyhre's issue. Could you start a new issue with your post above, please? |
Sure, no problem. re-posted it here |
Hey Percolate Team -
Is it possible to return the counts from publish-counts broken down by an attributes from the collection? I have an "events" collection with a user_id and Type and I would like to know the count of docs in the collection broken down by both. In sql terms select count(*) from events group by user_id, type.
Is this possible with publish-counts?
picture of desired-ish output
The text was updated successfully, but these errors were encountered: