title: How to manage user presence with Firestore in angular firestore
body: <p>i tried using presence system but after tab is closed the script doesn't work. what to do to change status to offline .</p>
  
  <pre><code>const db = firebase.firestore();
  
  const usersRef = db.collection('users'); // Get a reference to the Users collection;
  
  // Set the specific user's online status to true
  usersRef
    .doc(userId)
    .set({
      online: true,
    }, { merge: true});
  </code></pre>