我有一个简单的加密货币应用程序,它使用API来获取价格。我使用Firestore来存储我的API密钥,我的应用程序在启动时从Firestore中检索我的API密钥。我的API键是我在Firestore中拥有的唯一数据。由于我的应用程序不允许用户创建配置文件/帐户,所以我的规则中不包括用户身份验证。我对Firestore的安全规则是:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Data/{Data} {
allo
所以问题是,当我试图使用forEach函数获取详细信息时,它会给出所有用户的详细信息,这些详细信息可以在firestore..let me explain上使用代码进行解释: 下面是我在配置文件页面中获取详细信息的代码: import React from 'react';
import firebase from 'firebase';
const firestore = firebase.firestore();
class ProfilePage extends React.Component {
state = {
prof
在Cloud数据库中,由于一个集合下的文档过多,我通常用来读取文档的快照代码无法工作。请看下面的代码,这是我们试图读取的数据。在使用期间,应用程序挂起,导致设备也挂起。
我们已经初始化了应用程序并创建了firestoredb连接,同时使用下面的代码加载了我们的应用程序。
//firebase is a global namespace from which all Firebase services are accessed.
firebase.initializeApp(firebaseConfig);
//Initialize firebase
我试图构造我的数据,当有人将一个新产品添加到数据库中时,所有用户都会收到他们列表中的新产品,因此新产品就会出现在他们的屏幕上。但是,如果用户决定删除该产品,他们可以删除它,但只为自己。是否有一个云修复排序/排序/过滤,我应该使用它来完成这一点?
我想我可以用下面这样的东西:
final theProduct = Provider.of<Products>(context);
products = await firestore.collection('products').getDocuments()
for (product in products.docum
如何锁定对顶级集合的访问?我想阻止人们列出或删除顶级集合。 此规则集是否会阻止列出和删除顶级集合,但允许完全访问文档? rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
allow get;
allow list: if false;
allow create;
allow update;
allow delete: if false;
match /{document=**} {
all
目前,我正在使用GeoFirebase库的一部分以及Firestore,以允许地理查询。当我设置一个帖子的Geo散列时,我会这样做-- if let geoHash = GFGeoHash(location: location.coordinate).geoHashValue {
但是,为了使地哈希查询不那么具体,我计划在查询时截断它的一部分;当前,该查询看起来类似于
var geoQuerySpecific = GFGeoHashQuery()
let geoQueryHash = GFGeoHashQuery.queries(forLocation: (lastLoca
我正在尝试通过单击事件来删除firestore文档的方法。 这是我到目前为止所拥有的。x是我从firestore获得的文档id。但是,如何根据页面中显示的内容动态更改ID呢?以便用户可以删除他们想要内容。 var deleteContent = document.getElementById('delete');
deleteContent.addEventListener('click', function(e) {
// get current document ID
x = 'poOjcQce2iiKzp2FaFVA'
我尝试通过文档的"id“来获取特定文档的信息,以显示该文档的信息。
我在服务中使用的代码是:
class SentenciasFireBase {
//This is a class where I have all the services of firebase
...
obtenerVacaciones(String empleado) async {
//empleado is the document id
return await Firestore.instance.document('Vacaciones/$empleado'