title: How do I limit the snapshot to 1 document?
body: <p>I have a real-time listener set up, I have ordered the data but I only want to retrieve the latest data value.</p>
  
  <p>I've tried adding .limit(1) but it is not working</p>
  
  <pre><code>const callSheet = document.querySelector('#call-sheet');
  const form = document.querySelector('#add-call-form');
  
  // create element and render calls
  function renderCall(doc){
      // tags
      // unique firestore document id
      let li = document.createElement('li');
      let van = document.createElement('span');
      let time = document.createElement('span');
      let ete1 = document.createElement('span');
      let ete2 = document.createElement('span');
  
      if (doc.data().van == 3) {
          // set document id
          li.setAttribute('data-id', doc.id);
  
          // set other data fields
          van.innerHTML = "Van " + doc.data().van + '&lt;br /&gt;'
          time.innerHTML = "Last dispatched at " + doc.data().time + '&lt;br /&gt;';
          ete1.textContent = "ETE: " + doc.data().ete1 + " - " + doc.data().ete2 + " minutes";
  
          li.appendChild(van);
          li.appendChild(time);
          li.appendChild(ete1);
  
          callSheet.appendChild(li);
      }
  }
  
  // retrieve the Call Information collection
  // snapshot is what you get back from the method call 
  // (a representation of the different data in the collection)
  // real-time listener:
  db.collection('Call Information').orderBy("time", "desc").limit(1).onSnapshot(snapshot =&gt; {
      let changes = snapshot.docChanges();
      changes.forEach(change =&gt; {
          if(change.type == 'added'){
              renderCall(change.doc)
          } else if (change.type == 'removed'){
              let li = callSheet.querySelector('[data-id=' + change.doc.id + ']');
              callSheet.removeChild(li);
          }
      })
  })
  </code></pre>
  
  <p>I am trying to get the latest 1 document for each van, but even though there are documents in the database for each van, when I change the <code>if (doc.data().van == 3)</code> to any other value (e.g. 1 or 2), no data is displayed.
  If I remove the <code>orderBy</code> and <code>limit</code>, all the data values are displaying normally for each van.</p>