File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,11 @@ def main():
80
80
81
81
query = json .dumps ({"otherkey" : "bar" })
82
82
print ("Should return third item with auto-generated _key: %s" % json .dumps (collection .data .query (query = query ), indent = 1 ))
83
-
83
+
84
+ # passing query data as dict
85
+ query = {"somekey" : {"$gt" : 1 }}
86
+ print ("Should return item2 and item3: %s" % json .dumps (collection .data .query (query = query ), indent = 1 ))
87
+
84
88
# Let's delete the collection
85
89
collection .delete ()
86
90
Original file line number Diff line number Diff line change @@ -3640,6 +3640,11 @@ def query(self, **query):
3640
3640
:return: Array of documents retrieved by query.
3641
3641
:rtype: ``array``
3642
3642
"""
3643
+
3644
+ for key , value in query .items ():
3645
+ if isinstance (query [key ], dict ):
3646
+ query [key ] = json .dumps (value )
3647
+
3643
3648
return json .loads (self ._get ('' , ** query ).body .read ().decode ('utf-8' ))
3644
3649
3645
3650
def query_by_id (self , id ):
You can’t perform that action at this time.
0 commit comments