reactjs - 无法从 Firestore 中查询某些数据(反应)
问题描述
我在这样的 fireStore 中有一个安全角色
allow read: if resource.data.uid == request.auth.uid;
我正在尝试像这样获取数据
export function GetPatients(limit) {
return async (dispatch) => {
await firebase
.firestore()
.collection("patients")
.doc(firebase.auth().currentUser.uid)
.collection("patient")
.orderBy("creation", "desc")
.where("uid", "==", firebase.auth().currentUser.uid && "importent" ,"==" ,true)
.limit(limit)
.onSnapshot((result) => {
let Patients = result.docs.map((doc) => {
const data = doc.data();
const id = doc.id;
return { id, ...data };
});
lastPatient = result.docs[result.docs.length - 1];
dispatch({ type: GET_PATIENTS, Patients });
});
};
}
我是否需要更改角色或查询数据的方式有问题?