I am attempting to read data from a Firestore collection using the following code:
auth.onAuthStateChanged(user => {
if(user) {
console.log('User logged in:', user)
db.collection('MediCorePatientUsers').where("GPID", "==", user.email)
.get().then((snapshot) => {
snapshot.docs.forEach(doc => {
renderPatientList(doc);
})
})
document.getElementById("nameOfUser").innerHTML = user.email;
} else {
console.log('User logged out');
}
});
This works as intended and displays the correct data. I am attempting to add another condition to the code using an ‘or’ operator to display data where the field “InsuranceCompany” is also equal to the current user email:
db.collection('MediCorePatientUsers').where("GPID", "==", user.email || "InsuranceCompany", "==", user.email)
.get().then((snapshot) => {
snapshot.docs.forEach(doc => {
renderPatientList(doc);
})
})
However, this is resulting in no data being displayed when either of the conditions is true. What is incorrect with this code?