title: Keeping track of unread comments in Mongodb
body: <p>I've got an Meteor/React app that has a chat window for all signed in users. Comments are stored in Mongo:</p>
  
  <pre><code>{ 
    "_id" : "vA6uLZA8AmYLf8NxA", 
    "comment" : "yada yada", 
    "name" : "JOHN DOE", 
    "date" : "Tue 9:07 pm", 
    "value" : NumberInt(20) // this number increments by one for each comment
  }
  </code></pre>
  
  <p>I'm going to use a badge to set the count of unread messages. All unread messages will be considered "read" (unread count set to 0) if the chat page is mounted. </p>
  
  <p>I'm struggling to implement this effectively. I'm thinking that localStorage would have to keep track of the "last seen" message count somehow and some sort of comparison made between the localStorage value and the current message count in Mongo? </p>
  
  <p>How would you go about it? </p>