I'm quite new to Cloud Firestore (aren't we all?) and I've added some data to my db using the admin SDK in Node.js. It shows up on the console, but under the doc it says "This document does not exist, it will not appear in queries or snapshots." I'm not sure why this is? Here's a screenshot:
The key thing to realize is that just because you create a document at root_collection > root_doc > sub_collection > sub_doc
does not mean there is actually a document at root_collection > root_doc
.
So in order to show you the documents under ... > Events > 10-12-2017 > Phase Data
, the console is showing 10-12-2017
as if it was a document, but it's letting you know that there is actually no document at that location. So if you do a query for the documents under ... > Events
, 10-12-2017
will not show up.
I think this is the answer you all are looking for: When you create a document like:
let ref = Firestore.firestore().collection("users").document().collection("data")
you aren't creating an actual location for that document with the auto-generated id. Rather, add an empty field as so:
let tempRef = Firestore.firestore().collection("users").addDocument(data: ["dummy":"text"])
let id = ref.documentId
let ref = Firestore.firestore.collection("users").document(id).collection("data")
I tried it out and works fine now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With