TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Best practices to store notifications in Node.js + MongoDB application?

1 pointsby nagarjunabout 9 years ago
This is somewhat of a complicated subject. Each application has it&#x27;s own needs but I&#x27;m curious to know what best practices and architecture you all recommend when storing a user&#x27;s notifications in a Node.js + MongoDB application.<p>Essentially, we have a notifications icon in our web application (similar to Facebook etc.) that shows notifications based on certain events triggered by other users in the application. Some notifications can also have actions when clicked on them.<p>The plan I had:<p>1. Store all notifications in a &#x27;notifications&#x27; collection<p>2. Each document in the collection has the notification text, unread status and action (if applicable)<p>3. When the user clicks the notification icon in the interface, they see a list of unread notifications and upon closing the drawer, an XHR gets called to mark all notifications as read<p>Is this a good way to do it?

1 comment

davelnewtonabout 9 years ago
I&#x27;m not even sure I understand what design issue you&#x27;re trying to solve. Users have a list of notifications and they have associated metadata. What else would you do?
评论 #11160656 未加载