title: Firestore arrayUnion
body: <p>I'm building a basic CRUD app with vue.js and firebase. I'm trying to build out a favorites functionality and have ran into a persistent problem storing the data.</p>
  
  <p>When a using clicks the add to favorites button I'm attempting to add the document id to an array in a "user profile" document. Here's the code:</p>
  
  <pre><code>export function addNewUserAction (type, key, userID){
    console.log(userID);
    console.log(key);
  
    firebase.firestore().collection('userActions').add({
      type: type,
      listing: key,
      user: userID,
      time: Date.now()
    })
    if(type === 'favorite'){
      var sendfav = db.collection('userProfiles').doc(userID).update({
        favs: firebase.firestore.FieldValue.arrayUnion(key)
      });
    }else if(type === 'xout'){
      var sendxout = db.collection('userProfiles').doc(userID).update({
        xouts: firebase.firestore.FieldValue.arrayUnion(key)
      });
    }else{
      console.error(type + " is not a user action");
    }
  }
  </code></pre>
  
  <p>I get the following error in the console:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'arrayUnion' of undefined
      at addNewUserAction
  </code></pre>
  
  <p>I have firebase and the db ref imported, and have ran a bogus .set() through each reference to confirm they are pointing at the right spots. I also already have the arrays created in 'userProfile' document.</p>
  
  <p>The firebase install is fresh, like last week fresh, so I should have the function in my build.</p>
  
  <p>Seems that arrayUnion is just not working. Any ideas? The other firestore functions are workin so I'm not sure. Am I blatenly missing something? Thanks</p>