我有一个文档"用户",其中有一个名为"照片"的键.这是保存的字符串数组,即"照片"文档的ID.
我想通过此"照片"字段查询"用户":我希望在"照片"属性中拥有此ID的所有用户.
这可能通过firestore吗?
data-modeling firebase google-cloud-platform google-cloud-firestore
有时我需要等待.forEach()方法完成,主要是在'loader'函数上.这就是我这样做的方式:
$q.when(array.forEach(function(item){
//iterate on something
})).then(function(){
//continue with processing
});
Run Code Online (Sandbox Code Playgroud)
我不禁觉得这不是等待.forEach()完成的最好方法.做这个的最好方式是什么?
我只想知道我的InfluxDB数据库在我的硬盘上占用了多少空间.stats()命令给了我几十个数字,但我不知道哪一个显示我想要的.
从昨天开始,当您通过 App Store Connect 在 App Store 上提交应用程序以供审核时,将强制执行新的隐私政策。昨天之前,我能够提交我的应用程序,但今天,我收到以下错误:
在您提交此应用以供审核之前,管理员必须在“应用隐私”部分提供有关应用隐私惯例的信息。了解更多。
当我转到 General -> App Privacy 时,我收到以下消息:
[...] 帐户持有人和管理员有责任披露从该应用程序中收集了哪些数据以及如何使用这些数据。
根据本指南(第 3 步),应该会出现一个“开始”按钮,指向我应该能够回答隐私问题的页面。但是,该按钮不会出现。似乎我无法在其他任何地方回答这些问题,即使我的角色是admin. 有没有其他人遇到同样的问题?我是否忽略了什么?
请注意,我admin仅在几分钟前被提升为。可能是我的角色尚未传播到隐私部分,但 app connect 的其余部分确实正确反映了我的新角色,因此它看起来不像没有传播。
Firestore.firestore().collection("users").document(model.id).setData(["owningRoom" : newRoom])
Run Code Online (Sandbox Code Playgroud)
我在Firestore中用Swift 4来称呼这个.我想在集合"users"中设置文档的数据.它给了我以下错误:
Invalid document reference. Document references must have an even number of segments, but users has 1
Run Code Online (Sandbox Code Playgroud)
怎么会?我首先调用集合,然后是文档,因此是2段?
我一直在绞尽脑汁地想用 SwiftUI 2 创建一个想要的匹配几何效果。在这个学习过程中,有些东西通过了我的道路,我真的无法解释。我将举一个例子。
我尝试创建一个“列表”->“详细信息”过渡,其效果通常称为“英雄”效果。列表视图的个人资料图片会转换为详细视图上的大横幅。
为了实现这一目标,我创建了两个带有几个修饰符的 KFImage(KF = Kingfisher,一个我用来方便下载和缓存图像的包):
列表显示:
if !isProductDetailViewPresented {
KFImage(store.results.first?.images?.first?.url)
.resizable()
.cornerRadius(30)
.scaledToFill()
.matchedGeometryEffect(id: "image.testprod", in: animationNamespace!, anchor: .center, isSource: !isProductDetailViewPresented)
.animation(.easeInOut(duration: 0.3))
.frame(width: 60, height: 60, alignment: .center)
.zIndex(999)
}
Run Code Online (Sandbox Code Playgroud)
详细视图:
if isProductDetailViewPresented {
...
KFImage(product?.images?.first?.url)
.resizable()
.scaledToFill()
.cornerRadius(30)
.matchedGeometryEffect(id: "image.testprod", in: animationNamespace!, anchor: .center, isSource: isProductDetailViewPresented)
.frame(height: 300)
.animation(.easeInOut(duration: 0.3))
...
}
Run Code Online (Sandbox Code Playgroud)
...这几乎成功了;不知何故,我的图像不会受到限制.frame(width: 60, height: 60)。相反,它会拉伸以使图像适合视图,使宽度大于 60。但高度仍保持在 60。
为了解决这个问题,我想;也许这个.frame()修饰符应该放在.matchedGeometryEffect()修饰符之前。但当我这样做时,只有两个图像的位置发生转变;不是尺寸。这让我认为修改器将帧“固定”到修改器之前.matchedGeometryEffect()的修改器位置。.frame().matchedGeometryEffect()
这很奇怪,因为互联网上的几个示例显示了在.frame()before …
因此,我很高兴一直在使用async / await,因为Firebase Cloud Functions支持节点8。我正在努力做一件事情。使用可调用函数时,系统会告知您必须在函数中返回一个promise,否则它将无法正常工作。使用原始的诺言时,我很清楚如何使用它:
exports.createBankAccount = functions.region('europe-west1').https.onCall((data, context) => {
return promiseMethod().then((result) => {
return nextPromise(result);
}).then((result) => {
return result;
}).catch((err) => {
// handle err
})
});
Run Code Online (Sandbox Code Playgroud)
但是现在,异步等待着,我不确定如何返回这个“承诺链”:
exports.createBankAccount = functions.region('europe-west1').https.onCall(async (data, context) => {
const res1 = await promiseMethod();
const res2 = await nextPromise(res1);
return res2;
// ??? Where to return the promise?
});
Run Code Online (Sandbox Code Playgroud)
有人知道吗
我开发了一个应用程序,让人们可以出售活动门票。每当售出门票时,我都会更新代表 firestore 中事件门票的文档以更新统计信息。
在高峰时间,此文档会更新很多(可能每秒 10 次)。有时对这个项目文档的交易会由于“竞争过多”而失败,这会导致统计数据不准确,因为统计数据更新被删除。我猜这是文档高负载的结果。
为了解决这个问题,我正在考虑将项目的统计信息从 firestore 中的项目文档移动到实时数据库。在此之前,我想确保这将真正解决我在项目文档上的争用问题。实时数据库能否比 firestore 文档更好地处理此类负载?将此类数据移动到实时数据库是否被认为是一种好习惯?
firebase ×4
ios ×2
javascript ×2
swift ×2
angularjs ×1
app-store ×1
async-await ×1
influxdb ×1
swiftui ×1