可以将Firestore查询表示为字符串 [英] Is is possible to represent a firestore Query as string

查看:36
本文介绍了可以将Firestore查询表示为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用getter属性 path CollectionReference 表示为字符串.这对于单元测试非常方便.例如, admin.firestore().collection('cities').doc('LA').path 返回"cities/LA"

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"

以String表示的 Query 怎么样?

What about Query represented as String ?

例如,有一种方法可以实现这样的 admin.firestore().collection('cities').where('name','==','LA').toString()来打印这样的内容:" cities/{where $ name =='LA'}"

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'}"

这对于单元测试很方便

推荐答案

来自

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

这篇关于可以将Firestore查询表示为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆