So right now I am currently storing data with a number after it like EmailSubject1, EmailSubject2, etc which obviously is a stupid way of doing things.
I would instead like to store these in arrays like EmailSubject[1], EmailSubject[2] etc.
I spent some time looking over the firebase documentation and searching online but was struggling to find a solution and I am unfamilar in storing things in firebase this way personally.
let z = 0;
for (z = 0; z < 20; z++) {
db.collection("Users")
.doc("6IzsLbD4r4R5RXdGB5BQy6xq8Dc2")
.set(
{
["EmailSubject" + z]: mail.subject,
["EmailBody" + z]: mail.text,
["EmailFrom" + z]: mail.from,
["EmailDate" + z]: newDate,
},
{ merge: true }
)
.then(() => {
console.log("Doc successful");
return null;
})
.catch((error) => {
console.error("Error writing doc", error);
});
}
Here is my code, any help would be much appreciated =]