发送动态值作为参数存储在哪里,查询

时间:2019-04-10 22:00:20

标签: python-3.x google-cloud-firestore

  1. 我需要将列表中的数据与b_age数据进行比较,其中查询的值是动态的。我正在使用python执行查询:

    firestore

    此代码不适用于mail='sampoornitb@gmail.com' doc_ref = store.collection(u'students').where(u'email', u'==', 'mail')

  2. 如果我使用:

    NameError

    一切正常。

您可以建议使用动态值作为参数的查询吗?

1 个答案:

答案 0 :(得分:0)

不要在要传递给Firestore API的变量的名称周围加上引号。带引号的字符串实际上是在Python中获取的。 (与Firestore SDK无关。)

mail='sampoornitb@gmail.com'
doc_ref = store.collection(u'students').where(u'email', u'==', mail)