I’ve created a Meteor chat-like app that is already being used in a couple online courses as a live interaction system between teachers and students.
I’ve used mongoDB, and realized that, for reactivity, it reloads all my chat comments when something is inserted in the DB. The issue is that, because there are a lot of students commenting at the same time, some comments get stuck at the end of the comments array - because of some mongoDB mass insertions from different clients I think - and are always shown first.
To solve this issue, I’ve thought of sorting the comments by date (something I thought was already being done by mongo), but I’m very concerned about performance, as it would sort it again for every user for every single new comment inserted.
Can anybody help me with this? Is this a real solution? Will this really affect the performance?
Thanks in advance!