I am using nodejs to create firestore documents in the following structure
(CollectionName)/(id)/(document)
and all though my code is successfully adding the document, it is not actually creating the parent document (id)
if it does not already exist.
Firebase is reporting the following:
This document does not exist, it will not appear in queries or snapshots
and this is correct, i can not see a list of (id)'s when querying the database. Below is my code, how can i fix it?
for (let i = 0; i < filledOrders.length; i++) {
let query_new_open = await db.collection("OpenOrder").doc(id).collection(filledOrders[i]._who).get();
if (query_new_open.docs.length > 0) {
await db.collection("OpenOrder").doc(id).collection(`${filledOrders[i]._who}`).doc(filledOrders[i]._priceInWei + "_" + filledOrders[i]._orderKey).delete();
await update_orderBook(filledOrders[i], false);
}
}
if (orders.length > 0) {
for (let i = 0; i < orders.length; i++) {
await db.collection("OpenOrder").doc(id).collection(`${orders[i]._who}`).doc(orders[i]._priceInWei + "_" + orders[i]._orderKey).set(orders[i]);
await update_orderBook(orders[i], true);
}
}