Rank 2: Process
Hi, I need to do an analysis of an entire collection by user, what would be the best way to address the problem
thank you
Votes
1
Replies
14
Participants
Unknown
Messages
15
Rank 2: Process
Hi, I need to do an analysis of an entire collection by user, what would be the best way to address the problem
thank you
What kind of analysis?
Rank 2: Process
perform operations with the information of the collections, that is, perform calculations to determine earnings of the day, month, year per user.
Moderator
I do that by updating it when a new income (for example) comes, so you have a total earnings field and you update it by + the new earnings. This is done with a function to prevent data manipulation
i would use functions and maybe store incremental data or so in a collection.
Rank 2: Process
The detail is that if a number changes, a calculation process must be done for all the information of that user. I don't know if that concept that you think works or there may be some other approach.
Rank 2: Process
I like that approach although I don't know if it would apply with thousands of data?
it depends on what kind of reporting you want.
for this use case, i would have a collection of daily earnings where each document is the earnings of a user for a day. i'd have a function that updates that document when earning changes for a particular day. then, you can generate a report using the documents in that collection
Rank 2: Process
the idea is perfect. My question would be that function. Can I make it run when it detects a change?
yes, you can have functions trigger on an event like document creation or delete
Rank 2: Process
OK. He asks how I can obtain the information of a user in nodejs (this is already executed on the server side) since I need a session type to act with his user.
how is this related to your original question?
Rank 2: Process
I understand, I open another question. It's already a nodejs related topic. thank you.
Moderator
[SOLVED] What do you recommend to do a data analysis of a collection? It has a lot of information.