0

I want to get all the documents where the automatically assigned Firestore ID doesn't match the ID of my current user. The code I have is just an example but it doesn't work since the documents themself don't have an "ID" field.

database.collection("users").where("id", "!=", userId).get().then(data => {
  data.forEach(user => {
    if (user.data().username == editUsername.value) {
      alert("Username is taken")
      canBeEdited = false
    } else if (user.data().email == editEmail.value) {
      alert("Email is taken")
      canBeEdited = false
    }
  })
})
Dharmaraj
  • 29,469
  • 5
  • 26
  • 55
thejj
  • 43
  • 3

0 Answers0