我有一个带有成员数组的“聊天”集合,其中包含参与聊天的用户。问题是我想获得当前用户参与的所有聊天。
我用这个查询来做到这一点:
getUserChats(): Observable<Chat[]> {
return this.auth.currUser
.pipe(
take(1),
switchMap(user => this.afs
.collection('chats', ref => ref.where('members', 'array-contains', `/users/${user.uid}`))
.snapshotChanges()
.pipe(
map(actions => {
return actions.map(action => {
const data = action.payload.doc.data() as Chat;
const id = action.payload.doc.id;
return {id, ...data};
});
})
) as Observable<Chat[]>
)
);
}
Run Code Online (Sandbox Code Playgroud)
这适用于字符串,但不适用于引用。我怎样才能让它在参考文献上工作?
绿色有效红色无效
绿色:字符串红色:参考
我有一个带有 PyTorch 和 Tensorflow 的 conda 环境,它们都需要 CUDA 9.0(来自 conda 的~cudatoolkit 9.0)。在使用torchvision和cudatoolkit(就像他们在他们的网站上提供的)安装pytorch之后,我想安装Tensorflow,这里的问题是我收到这个错误:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment: …Run Code Online (Sandbox Code Playgroud) 我需要从Firebase集合中获取第一个元素,然后将其删除,但无法弄清楚该如何做。我需要它来实现云功能。
await ref
.doc(ref.limit(1).get().docs[0]);
Run Code Online (Sandbox Code Playgroud) javascript firebase google-cloud-functions google-cloud-firestore
我正在尝试从 Fireship ( https://fireship.io/lessons/flutter-firebase-google-oauth-firestore/ )教程中实现 AuthService
我完全复制了他的 AuthService:
AuthService() {
user = Observable(_auth.onAuthStateChanged);
profile = user.switchMap((FirebaseUser u) => {
if (u != null) {
return _db.collection("users").document(u.uid).snapshots().map((snap) => snap.data);
} else {
return Observable.just({});
}
});
}
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
如果我从他的网站复制代码(完全相同),则没有错误。卧槽?有人可以解释这个或帮助吗?谢谢!
dart firebase firebase-authentication flutter google-cloud-firestore
firebase ×3
angular ×1
angular7 ×1
conda ×1
dart ×1
flutter ×1
javascript ×1
pytorch ×1
tensorflow ×1
torch ×1
typescript ×1