我正在尝试编写这样的新文档:
database.collection('NegociosDev').doc('Peluquerías').collection('Negocios').doc('PR01').collection('citas').add({
CheckIn: formattedDate(citaDate) + ' ' + formattedTime(horaSelec),
CheckOut: fechaFinal.toString(),
Dirección: 'Avenida Los Majuelos 54',
Negocio: 'PRIVILEGE SALONES',
Precio: pre.toString(),
Servicio: servicioSeleccionado.toString(),
extraInformation: empleadoSelect.toString(),
idUsuario: idUser.toString(),
})
但是每次我尝试编写任何内容(我可以读取它)时都会收到此错误:
Unhandled Promise Rejection: FirebaseError: Missing or insufficient permissions.
使用此规则:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow write: if request.auth.uid != null;
allow read;
}
}
}
我没有做任何身份验证,我只是想写一些东西,但我不想改变规则。
最佳答案
您必须正确设置 Firestore 规则。
我建议您观看此官方视频 [1],其中他们解释了您需要了解的所有内容。
该视频是“了解 Cloud Firestore”播放列表的一部分 [2]。我强烈建议您观看整个播放列表。不需要太长时间,而且确实有返回。
[1] https://youtu.be/eW5MdE3ZcAw
[2]https://www.youtube.com/playlist?list=PLl-K7zZEsYLluG5MCVEzXAQ7ACZBCuZgZ
关于reactjs - 如何编写文档 Firestore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62999264/