I'm currently facing an issue trying to store stock prices in Firestore. I want the structure to resemble something similar to SQL, like this:
const d1 = new Date();
const result = d1.getTime();
console.log('Epochtime',result);
database.collection("stock1").doc("exchange1").collection(date).doc('prices').set({"price":"price_value"})
The problem arises when attempting to use a variable containing the date as part of the collection name. Despite using epoch time as a numeric representation, such as 1636213439908
, it results in the error:
Value for argument "collectionPath" is not a valid resource path. Path must be a non-empty string.
. Strangely, the same variable can be successfully stored as a value within a collection. Unsure about what I might be doing incorrectly here.