小编fil*_*lip的帖子

'array-contains' 查询不适用于引用的 Firestore

我有一个带有成员数组的“聊天”集合,其中包含参与聊天的用户。问题是我想获得当前用户参与的所有聊天。

我用这个查询来做到这一点:

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)

这适用于字符串,但不适用于引用。我怎样才能让它在参考文献上工作?

带有集合的图像

绿色有效红色无效

绿色:字符串红色:参考

firebase typescript angular google-cloud-firestore angular7

11
推荐指数
2
解决办法
2544
查看次数

Anaconda 读取错误的 CUDA 版本

我有一个带有 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)

conda torch tensorflow pytorch

5
推荐指数
1
解决办法
5039
查看次数

从集合中获取第一个元素并将其删除

我需要从Firebase集合中获取第一个元素,然后将其删除,但无法弄清楚该如何做。我需要它来实现云功能。

await ref
      .doc(ref.limit(1).get().docs[0]);
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-functions google-cloud-firestore

2
推荐指数
1
解决办法
1701
查看次数

意外的文本“返回”

我正在尝试从 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

2
推荐指数
1
解决办法
721
查看次数