我在 firestore 的集合中有一系列嵌套对象,它们有一个 UID 的键。我想通过检查他们的 UID 是否是对象键(基本上如果它存在)来查询与用户相关的所有文档。这是firestore中的模型:

这就是我目前尝试返回文件的方式:
getAllTenancyOffersByUserId() {
return this.afs.collection('collection_name', ref =>
ref.where(`application.members.${this._auth.currentUserId}`, '==', !null),
);
}
Run Code Online (Sandbox Code Playgroud)
但这没有任何回报。我知道我可以通过该状态进行查询,但是它会不断更新,因此会导致问题
我已经设置了一个新的 Firestore 环境,当尝试通过云功能上传然后从存储中读取数据时,出现以下错误:
project_id@appspot.gserviceaccount.com does not have storage.objects.get access to the Google Cloud Storage object。
我在网上查看并在 Google 云控制台中添加了Storage Admin此服务帐户的 IAM 权限,但我仍然遇到同样的错误。
以前有人遇到过这个问题吗?我也尝试过只Owner向服务帐户授予角色,但仍然遇到相同的错误。
google-cloud-storage firebase google-cloud-functions google-developers-console google-cloud-iam
我正在尝试使用python将firestore上新文档的文档ID添加到对象本身,但是添加时它会缩短字符串,而实际上并没有添加相同的ID。
我已经打印了ID,并说它应该是相同的。虽然在消防局中有所不同。
doc_ref = db.collection(u'prime_location').document()
print('ID: ', doc_ref.id)
docId = doc_ref.id
# set object and push to firebase
doc_ref.set({
u'property_id': docId,
u'property_address': address,
u'number_of_beds': number_beds,
u'number_of_baths': number_baths,
u'property_rent': property_price,
u'post_code': postcode,
u'property_photo': property_image,
})
Run Code Online (Sandbox Code Playgroud)
例如,文档的ID为:“ aMqwOsjDbOuQmi8PZmot”,但“ property_id”值显示为:“ YU1xd09zak ...”。有人知道为什么会发生这种情况吗?