我想根据子字符串匹配查询Cloud Firestore数据库。关于documentation,可以使用array_contains
运算符来完成。
> The where() method takes three parameters: a field to filter on, a
> comparison operation, and a value. The comparison can be <, <=, ==, >,
> >=, or array_contains
但是,当我尝试使用它时,出现以下错误:
doc_ref = db.collection(u'full').where(u'desc', u'array_contains', snippet).get()
obj = doc_ref[0].to_dict()
ValueError: Operator string 'array_contains' is invalid. Valid choices are: <, <=, ==, >, >=.
在这一点上,我不知道该运算符的格式应不同,文档已过时,或者我只是做错了。如果能早些做的人能告诉我正确的解决方案,我将不胜感激。
答案 0 :(得分:1)
经过一番挖掘,我在array_contains示例的Python选项卡下找到了“尚不支持”。