File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
functions/categories/libs Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
- import json
3
2
from google .cloud import firestore
3
+ from google .cloud .firestore_v1 .base_query import FieldFilter
4
4
from .result import Result
5
5
from .utils import convert_to_array
6
6
7
7
DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
8
+ TABLE = 'categories'
8
9
9
10
def list_data (params ):
10
- ref = DB .collection (u'categories' )
11
+ ref = DB .collection (TABLE )
11
12
12
13
query = ref
13
14
@@ -27,7 +28,7 @@ def list_data(params):
27
28
category_array = convert_to_array (params ['category' ])
28
29
29
30
for category in category_array :
30
- results = query .where ("category" , "==" , category ).stream ()
31
+ results = query .where (filter = FieldFilter ( "category" , "==" , category ) ).stream ()
31
32
for doc in results :
32
33
data .append (doc .to_dict ())
33
34
You can’t perform that action at this time.
0 commit comments