@@ -145,17 +145,19 @@ def find(self, query=None, limit=None) -> List[Document]:
145145 :param query: Condition to search Document
146146 :return: List of Document
147147 """
148-
148+
149149 # Default result
150150 _result = []
151151
152152 # Make sure the query implements the ``Mapping`` interface.
153- if not isinstance (query , Mapping | None ):
154- raise ValueError ('Document is not a Dictionary' )
153+ if query :
154+ if not isinstance (query , Mapping ):
155+ raise ValueError ('Document is not a Dictionary' )
155156
156- # Make sure the query implements the ``Mapping`` interface.
157- if not isinstance (limit , tuple | None ):
158- raise ValueError ('Document is not a Tuple' )
157+ # Make sure the query implements the ``Tuple`` interface.
158+ if limit :
159+ if not isinstance (limit , tuple ):
160+ raise ValueError ('Document is not a Tuple' )
159161
160162 # if limit, Check everything ok
161163 _limit_start = _limit_end = None
@@ -223,11 +225,9 @@ def find(self, query=None, limit=None) -> List[Document]:
223225
224226 self ._reset_cursor ()
225227
226-
227-
228228 return _result
229229
230- def delete (self , query : Mapping = None ) -> List [str ]:
230+ def delete (self , query = None ) -> List [str ]:
231231 """
232232 Delete single or multiple Document when meet the Conditions or ``query``.
233233
@@ -252,7 +252,7 @@ def delete(self, query: Mapping = None) -> List[str]:
252252
253253 return _doc_id
254254
255- def update (self , document : Mapping , query : Mapping = None ) -> List [str ]:
255+ def update (self , document : Mapping , query = None ) -> List [str ]:
256256 """
257257 Fetch all the Documents mathc the conditions and update them.
258258
@@ -288,7 +288,7 @@ def update(self, document: Mapping, query: Mapping = None) -> List[str]:
288288
289289 return _doc_id
290290
291- def count (self , query : Mapping = None , limit : tuple = None ) -> int :
291+ def count (self , query = None , limit : tuple = None ) -> int :
292292 """
293293 Return amount of Document found.
294294
@@ -319,7 +319,7 @@ def _find_document_by_query(self, query: Mapping) -> List:
319319 result = []
320320
321321 # Make sure the query implements the ``Mapping`` interface.
322- if not isinstance (query , Mapping | None ):
322+ if not isinstance (query , Mapping ):
323323 raise ValueError ('Document is not a Dictionary' )
324324
325325 # Get the length on Collection
@@ -351,7 +351,6 @@ def _find_document_by_query(self, query: Mapping) -> List:
351351 # If both values are same, then update ``_bag_of_query[i]`` as 1.
352352 _bag_of_query [i ] = 1
353353
354-
355354 else :
356355 continue
357356 else :
0 commit comments