title: Getting a number of online users with meteor-presence
body: <p>Is it possible to simply display a number of online users (currently logged in) with <a href="https://github.com/tmeasday/meteor-presence" rel="nofollow">meteor-presence</a>?<br>
  I see that documents in <code>Meteor.presences</code> collection do not delete themselves by default, so simple <code>Meteor.presences.find().count()</code> is not the value I'm looking for... Should I delete them manually or should I check if each document has <code>userID</code> field somehow?</p>
  
  <p>EDIT:<br>
  To illustrate a bit more what is happening to me, I tried to log in with 2 different users in 2 different browsers. After calling <code>Meteor.presences</code> I can see two documents in my collection, e.g.</p>
  
  <pre><code>docs: {
    djF3noxe3AhxDRfZw: {
      _id: "djF3noxe3AhxDRfZw",
      state: "online",
      userId: "SDeLPJzoabFt4Knei"
    }, {
    t4r2Q7KGKji4FPS9s: {
      _id: "t4r2Q7KGKji4FPS9s",
      state: "online",
      userId: "5zvYoC37aXSADGNEg"
    }
  }
  </code></pre>
  
  <p>After few minutes of inactivity, both docs look the same. After logging out (calling <code>Meteor.logout()</code>) with one user I still have 2 documents (even after few minutes), the only difference is that one of them has no more <code>userID</code>:</p>
  
  <pre><code>docs: {
    djF3noxe3AhxDRfZw: {
      _id: "djF3noxe3AhxDRfZw",
      state: "online"
    }, {
    t4r2Q7KGKji4FPS9s: {
      _id: "t4r2Q7KGKji4FPS9s",
      state: "online",
      userId: "5zvYoC37aXSADGNEg"
    }
  }
  </code></pre>
  
  <p>Only after closing that browser window the associated document deletes itself.<br>
  So, if I call <code>Meteor.presences.find().count()</code> when both windows are opened, I always get <code>2</code> in return, no matter of user's online/offline status.</p>
  
  <p>All the code I am using at the moment is the one from the example:</p>
  
  <pre><code>Meteor.publish('userPresence', function() {
    var filter = {}; 
    return Meteor.presences.find(filter, {fields: {state: true, userId: true}});
  });
  </code></pre>