I'm creating a firestore document that's not at the root level of an existing collection but somewhat deeper:
const response = await addDoc(
collection(
firestore,
'stats', //collection
'dayStats', //document
'years', //collection
'2023', //document
'january', //collection
),
statData
);
At the time of creation, the entire collection structure does not yet exist, but only a part of it (stats/dayStats/years).
What ends up happening is that stat document is successfully created in the correct place, but not the intermediary documents. They are in italics and there's a warning for them saying "This document does not exist, it will not appear in queries or snapshots".
I suppose this means that I need to be explicit about force creating these intermediary documents? Is there some kind of a config I can pass to the function, that would just create the intermediary documents in the path, if they to not yet exist? Or do I need to do this by hand each time I'm creating a document, that has a ancestor document that might not exist?