Cloud Firestore Quicktip — DocumentSnapshot vs. QuerySnapshot
Gerwin Sturm
2333

Hi Gerwin, thanks so much for the article. Is this at all related to this: https://stackoverflow.com/questions/46649651/angular-firestore-creating-an-observable-reference-to-a-document-with-the-ge

The issue here is that when using AF5 .snapshotChanges(), if I’m on a page that displays document data, and i hit my custom ‘delete document’ button, it correctly deletes the document and redirects back to a list. However, in the console it reads:

“core.es5.js:1020 ERROR Error: This document doesn’t exist. Check doc.exists to make sure the document exists before calling doc.data().”

At a guess, I think it’s an observable that realises the document is no longer there before routing back to a different view. However, I don’t want to use the ‘.get’ method because I want users to see live updates to the document.

I’m new to this, so any advice on how to best approach this would be great.

Goal:

  1. View a document and see live changes
  2. Hit delete button
  3. Navigate back to a list view
  4. Not have the error in the console
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.