我有一个简单的加密货币应用程序,它使用API来获取价格。我使用Firestore来存储我的API密钥,我的应用程序在启动时从Firestore中检索我的API密钥。我的API键是我在Firestore中拥有的唯一数据。由于我的应用程序不允许用户创建配置文件/帐户,所以我的规则中不包括用户身份验证。我对Firestore的安全规则是:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Data/{Data} {
allo
标题说明了一切。现在我有以下规则:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if request.auth != null
allow write: if request.auth != null
}
}
}
我是从allow read: if true更新的,因为这显然是不安全的。我有一些网页统计数据,我想与那些可能没有帐户或没有登录的访问者分享。我如何才能安全地允许对此进行读取?
我正在尝试创建一个python脚本来从我的Cloud Firestore数据库中获取数据。但我得到了一个奇怪的错误:
import firebase_admin
from firebase_admin import credentials, firestore
Exception has occurred: ImportError
Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.
File
我有一个页面,用户可以在其中输入他们的信息。当用户单击"Save“时,我会将所有内容打包到一个对象中,并使用AJAX将其发送到我的云功能。在那里,我使用Express框架设置了一个服务器,并将数据保存到Firestore中。
当我点击“保存”时,一切都正常。我的数据显示在Firestore中,没有错误。但是,当我编辑数据并再次单击"Save“(仍然在同一页面上)时,服务器端会出现以下错误:
Error: Element at index 0 should not be an empty string.
at new FieldPath (C:\Users\Me\Docu
我想在Firebase Cloud Firestore中追加数组中的数据。为此,我使用FieldValue.arrayUnion。
我试用了这些导入工具,但它们都不起作用
from firebase_admin import firestore
firebase_admin.firestore.FieldValue.arrayUnion()
AttributeError: module 'firebase_admin.firestore' has no attribute 'FieldValue'
from google.cloud import firest
目前,我使用以下查询来查询我的firestore数据库: def get_db_from_cloud(self):
"""
gets all the info in the db back to the flask app
as a dictonary ready to be cached
"""
docs = self.db.collection(self.collection_name).stream()
docs_dict = {}
for doc in docs:
我想使用订阅ruby中的firestore文档中的更改。
我可以使用以下代码获取文档引用和数据,但不确定如何订阅更改
# Firestore API
firestore = Google::Cloud::Firestore.new(project_id: 'project_id', credentials: './google-cloud-key.json')
# Get a reference to a document
ref = firestore.collection('collection_name').doc('id'