title: Do Firestore transaction locks block reads? (Server side SDK)
body: <p>I have a Node.js app with @google-cloud/firestore that has two collections, A and B.</p>
  
  <p>Collection A documents have a field called 'name' and one called 'collectionBId'. Collection B documents just have a field called 'name'. Name's in collection A and B are unique.</p>
  
  <pre><code>// Collection A
  { id: 1, name: 'example1', nameB: 'example2' }
  
  // Collection B
  { id: 1, name: 'example2' }
  </code></pre>
  
  <p>There an endpoint in Node.js that does:</p>
  
  <pre><code>const result = await firestore.runTransaction(async transaction =&gt; {
      const refA = firestore.collection('A').where('name', '==', reqParam1)
      const {docs: docsA} = await transaction.get(refA)
      const refB = firestore.collection('B').where('name', '==', docsA[0].data().name).where('name', '==', reqParam2)
      const {docs: docsB} = await transaction.get(refB)
      return docsB[0].data()
  })
  </code></pre>
  
  <p>This is significantly faster than (there is one less round trip):</p>
  
  <pre><code>const {docs: docsA} = await firestore.collection('A').where('name', '==', reqParam1).get()
  const {docs: docsB} = await firestore.collection('B').where('name', '==', docsA[0].data().name).where('name', '==', reqParam2).get()
  const result = docsB[0].data()
  </code></pre>
  
  <p>The transactions run in pessimistic locks in Node.js but is not clear if multiple users can use this transaction concurrently (eg. 100 users).</p>
  
  <p>On the docs, it is mentioned that when a write is performed there is a lock in place that prevent a concurrent write will that prevent reads also? Also, if a read transaction is used a lot, would that block writes?</p>
  
  <p>That leads to the following two questions:</p>
  
  <ol>
  <li>Do Firestore read transactions block other read transactions in Node.js?</li>
  <li>Do Firestore read transactions block write transactions in Node.js?</li>
  </ol>