我已经配置了如下的firestore规则:
service cloud.firestore {
match /databases/{database}/documents {
match /bills/{billid} {
allow create: if request.auth.uid != null;
}
}
}
我添加如下记录:
import firebase from 'react-native-firebase';
const db = firebase.firestore().collection('bills');
const data = {
year: year,
month: month,
description: description,
dateCreated: new Date()
};
db.add(data).then(ref => {
console.log('added record with id: ', ref.id);
}).catch(error => {
console.error("Error adding record: ", error);
});
但是,记录仍然进入firestore数据库,因为我已经设置了规则
允许创建:if request.auth.uid!= null;
我是否错误地设置了规则?