Google Firestore - What is OR equivalent?

∥☆過路亽.° 提交于 2019-12-23 05:30:56

问题


I see having mulitple where acts like AND, but how about OR?


回答1:


You can't really do an OR query in Cloud Firestore.

As a workaround, you could run two separate queries and merge them together on the client, or add some custom field that would essentially perform the "OR" query for you on the database. (For an example of that latter one, if you know you're going to often run an "age > 65 OR age < 18" query on the database, you could create a specific age_high_or_low field that you would set to true if the age field were greater than 65 or less then 18.)



来源:https://stackoverflow.com/questions/46719441/google-firestore-what-is-or-equivalent

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