Reactjs 我可以在firestore的嵌套文档中查询字段吗?

Reactjs 我可以在firestore的嵌套文档中查询字段吗?,reactjs,typescript,firebase,google-cloud-firestore,Reactjs,Typescript,Firebase,Google Cloud Firestore,我的结构如下: [Collection] users [Document] id [Collection] public [Document] data [Field] isArtist: boolean [Field] name: string [Collection] private [Document]

我的结构如下:

[Collection] users
     [Document] id
          [Collection] public
               [Document] data
                    [Field] isArtist: boolean
                    [Field] name: string
          [Collection] private
               [Document] data
                    //...some fields
     [Document] id
          [Collection] public
               [Document] data
                    [Field] isArtist: boolean
                    [Field] name: string
          [Collection] private
               [Document] data
                    //...some fields
现在我想用

{
     isArtist : true,
     name: "something"
}
我在文档中看不到任何有助于此案例的内容。

您可以使用。像这样的方法应该会奏效:

const query = db.collectionGroup('public')
  .where('name', '==', 'something')
  .where('isArtist', '==', true);

let matches = [];

query.get().then((snapshot) => {
  snapshot.forEach((doc) => {
    matches.push({id: doc.id, ...(doc.data())});
  });
});

谢谢它起作用了