title: Uncaught TypeError: db.collection is not a function for a real-time database in firebase
body: <p>when I try to access my collection I get the following error. My firebase app is initialized inside my main app component.</p>
  
  <p>I didn't include the config object here but I know that it works because I'm also using firebase auth in my app which works perfectly fine.
  App.js</p>
  
  <pre><code>componentDidMount(){
    if (!firebase.apps.length) {
      firebase.initializeApp(firebaseConfig);
    }
  }
  </code></pre>
  
  <p>Component where I am trying to make a db call</p>
  
  <pre><code>
  componentDidMount(){
  
  const db = firebase.database();
  const ref = db.collection('Users/Notes').doc()
  
    let getDoc = ref.get()
    .then(doc =&gt; {
      if (!doc.exists) {
        console.log('No such document!');
      } else {
        console.log('Document data:', doc.data());
      }
    })
    .catch(err =&gt; {
      console.log('Error getting document', err);
    });
  }
  
  </code></pre>
  
  <p>I am rendering this component immediately by including it in App.js, I don't know if that might somehow be a problem?</p>