I am hoping that someone has done something similar to this and can give me a tip before I embark on trial and error.
I’m building a small app to keep track of my share portfolio.
I envision two collections, one to track my portfolio buys/sells etc…
The other collection to track each stock codes performance.
That way if two people have the same stock, in their subscription the server can limit the records to only publish those which matter. Eg, if user A has stock XXX, then the publication will only publish the XXX document and limit the data contained to be relevant dates (not the entire history).
This is how I am thinking of structuring the data:
stockData
|- _id
|- stock code
|- mostRecentData (updated regularly throughout the day)
|- date
|- open
|- high
|- low
|- close
|- volume
|- historicData (only updated at end of day)
|-[{}] - array of objects
|- date
|- open
|- high
|- low
|- close
|- volume
The issue that I foresee is that there will be very little observer reuse as every portfolio will have a different subscription. I am not sure how this might negatively impact server performance. This is where trial and error was going to come into play…
I had hoped that if I just dump the data to the client, I can graph and run some logic on the client side rather than doing this all server side… I had previously built a similar app in PHP and it was all done on the server.
I did have a look at Mongo’s documentation but the examples they gave did not seem to fit my use case.