问题
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