gpt4 book ai didi

Querying a list of document id's in a firestore collection using react native firebase [duplicate](使用REACT Native Firebase[DUPLICATE]查询FireStore集合中的文档ID列表)

转载 作者:bug小助手 更新时间:2023-10-24 22:18:31 27 4
gpt4 key购买 nike




I'm using react-native-firebase. I have an array of document id's, and I need to query the associated documents by that array of id's.

我用的是Reaction-Native-Firebase。我有一个文档ID数组,我需要通过该ID数组查询相关的文档。


I can do something like this:

我可以这样做:


firestore().collection('Foo').doc('myDocId').get(); 

to get a single document by id, but I don't want to iterate through the list and query each one individually. However, I can't figure out how to query the collection by a list of document id's. What I'd really like to do is something like:

通过id获取单个文档,但我不想遍历列表并逐个查询每个文档。但是,我不知道如何通过文档id列表来查询集合。


firestore().collection('Foo').where('id','in',['myDocId1','myDocId2','myDocId3']).get();

however, this doesn't work (probably because 'id' is not actually a field in the documents, but rather the actual id of the document). How do I write an equivalent query against the collection's document id's?

然而,这并不起作用(可能是因为‘id’实际上不是文档中的一个字段,而是文档的实际id)。如何针对集合的文档ID编写等价的查询?


更多回答
优秀答案推荐
更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com