title: Remove item by key/value from Firestore array
body: <p>I have an array in Firestore that is structured like this:</p>
  
  <pre><code>palettes
      0: {date: 2019-05-01, name: "First Palette", palette: [array]}
      1: {date: 2019-05-02, name: "Palette 2", palette: [array]
  </code></pre>
  
  <p>Each item in the <code>palettes</code> array is a palette item with date, name, and the palette data in an array.</p>
  
  <p>In my React application, I'm trying to delete a specific palette in the Firestore db by referencing its <code>name</code> value and not having any luck.</p>
  
  <p>For example, if I have the <code>paletteName</code> "Palette 2" passed in from a click event, how can I delete the palette with that string as the name value?</p>
  
  <p>Here's what I've tried:</p>
  
  <p>1.</p>
  
  <pre><code>const deletePalette = paletteName =&gt; {
      db.collection('users').doc(user.uid)
      .update({
           palettes: firebase.firestore.FieldValue.arrayRemove({
               name: paletteName
           })
      })
      // ...
  }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>const deletePalette = paletteName =&gt; {
      db.collection('users').doc(user.uid)
          .update({
              palettes: firebase.firestore.FieldValue.arrayRemove(paletteName)
          })
      // ...
  }
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>const deletePalette = paletteName =&gt; {
      const ref = db.collection('users').doc(`${user.uid}/palettes/`)
  
      ref.update({
          [paletteName]: firebase.firestore.FieldValue.delete()
      })
      // ...
  }
  </code></pre>
  
  <p>4.</p>
  
  <pre><code>const deletePalette = paletteName =&gt; {
      db.collection('users').doc(user.uid)
      .update({
          palettes: palettes.filter(
              palette =&gt; palette.name !== paletteName
          )
      })
      // ...
  }
  </code></pre>
  
  <p>None of these are doing it. What am I missing here? </p>