I am querying multiple documents that have the same field value. I do not want to output the same field twice.
db.collection("books")
.where("ItemType", "==", "Book")
.orderBy("Author")
.limit(100)
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
let data = doc.data();
let row = `<tr>
<td>${data.Author}</td>
</tr>`;
let table = document.getElementById("myTable");
table.innerHTML += row;
});
})
.catch((err) => {
console.log(`Error: ${err}`);
});
As you can see the output, the fields are repeating. I don't want that to happen. How do I write my code in such a way that the field value only appears once, and if there is a repeated field value it should not display.