How to query a list of Objects with Firebase in Flutter

泪湿孤枕 提交于 2021-02-05 11:45:28

问题


I want to be able to query my collections for document Ids, and then get a list of documents. For Example: Collection [Users] -> Documents [001], [002], [003]. Now I want to query in Users for the ids 001 and 003. Is there an easy way to do this in flutter, or is the recommended way to just just query for 001 and 003 individually ?


回答1:


You can use an in query for anywhere up to 10 documents.

collectionRef.where("country", whereIn: ["USA", "Japan"])

If you have more than 10, you can either load them in batches of 10, or so individual calls for each document.



来源:https://stackoverflow.com/questions/61292207/how-to-query-a-list-of-objects-with-firebase-in-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!