Hi Meteorites,
How do i insert an insertmyCollectionCount field in a user profile after a successful insert on myCollection?
Here’s my situation, i’m having a hard time counting the documents that the user inserted on my collection which will be displayed on the dashboard, my app has 3 different roles, admin, HQ and Branch, the HQ and branch roles has the same dashboard except for admins which has it’s own dashboard, for admin, i can easily count all the documents by collection.find().count();, but for HQ and branch i’m unable to count the documents they each inserted on the same collection, even using publish-counts package here, so my solution is to add onSuccess or onSubmit hooks after insert.
My idea is to insert an autoincrement insertmyCollectionCount field inside users profile, by doing this, i can use the countFromField method here.
The problem is how do i insert on users profile after onSuccess or onSubmit insert operation on myCollection?
Or should I include the userId on the myCollection schema itself?
This are the remaining pieces of the puzzle on my apps.
Appreciate any help!
Thanks.