Is is possible to represent a firestore Query as string

巧了我就是萌 提交于 2021-02-11 06:11:31

问题


It is possible to represent a CollectionReference as a string with the getter proprety path . This is very handy for unit tests. For example admin.firestore().collection('cities').doc('LA').path returns "cities/LA"

What about Query represented as String ?

For example is there a way to something like this admin.firestore().collection('cities').where('name','==','LA').toString() to print something like this this: "cities/{where $name=='LA'}"

This would be handy for unit testing


回答1:


From this document, you can see that the inherited members of class Query uses toString. Is this what you are looking for?



来源:https://stackoverflow.com/questions/63339651/is-is-possible-to-represent-a-firestore-query-as-string

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