The data is the database is:
Comment:
{
uid1:"a"
uid2:"b"
}
and I wanted to add CommentContent which is:
uid3:"c"
I am trying to read from the database, append data to the data then update the database, and below is my code:
const OriginalContentSnap = await getDoc(doc(db, "Comment", curSnap.id));
const OriginalContent = OriginalContentSnap.data();
const CommentContent = {[uid] : commentDocID.id};
CommentContent = [...OriginalContent, CommentContent];
however, everything is fine until the last line where I am getting the following error:
Uncaught (in promise) TypeError: OriginalContent is not iterable
any help will be greatly appreciated.
OriginalContentto see what it is. Seems like its not an array, so you get that error