@@ -566,15 +566,31 @@ def response_handler(resp: Response) -> bool:
566566
567567 return self ._execute (request , response_handler )
568568
569- def truncate (self ) -> Result [bool ]:
569+ def truncate (
570+ self ,
571+ sync : Optional [bool ] = None ,
572+ compact : Optional [bool ] = None ,
573+ ) -> Result [bool ]:
570574 """Delete all documents in the collection.
571575
576+ :param sync: Block until deletion operation is synchronized to disk.
577+ :type sync: bool | None
578+ :param compact: Whether to compact the collection after truncation.
579+ :type compact: bool | None
572580 :return: True if collection was truncated successfully.
573581 :rtype: bool
574582 :raise arango.exceptions.CollectionTruncateError: If operation fails.
575583 """
584+ params : Json = {}
585+ if sync is not None :
586+ params ["waitForSync" ] = sync
587+ if compact is not None :
588+ params ["compact" ] = compact
589+
576590 request = Request (
577- method = "put" , endpoint = f"/_api/collection/{ self .name } /truncate"
591+ method = "put" ,
592+ endpoint = f"/_api/collection/{ self .name } /truncate" ,
593+ params = params ,
578594 )
579595
580596 def response_handler (resp : Response ) -> bool :
@@ -1747,14 +1763,6 @@ def insert_many(
17471763 successfully (returns document metadata) and which were not
17481764 (returns exception object).
17491765
1750- .. note::
1751-
1752- In edge/vertex collections, this method does NOT provide the
1753- transactional guarantees and validations that single insert
1754- operation does for graphs. If these properties are required, see
1755- :func:`arango.database.StandardDatabase.begin_batch_execution`
1756- for an alternative approach.
1757-
17581766 :param documents: List of new documents to insert. If they contain the
17591767 "_key" or "_id" fields, the values are used as the keys of the new
17601768 documents (auto-generated otherwise). Any "_rev" field is ignored.
@@ -1876,14 +1884,6 @@ def update_many(
18761884 (returns exception object). Alternatively, you can rely on
18771885 setting **raise_on_document_error** to True (defaults to False).
18781886
1879- .. note::
1880-
1881- In edge/vertex collections, this method does NOT provide the
1882- transactional guarantees and validations that single update
1883- operation does for graphs. If these properties are required, see
1884- :func:`arango.database.StandardDatabase.begin_batch_execution`
1885- for an alternative approach.
1886-
18871887 :param documents: Partial or full documents with the updated values.
18881888 They must contain the "_id" or "_key" fields.
18891889 :type documents: [dict]
@@ -1995,14 +1995,6 @@ def update_match(
19951995 ) -> Result [int ]:
19961996 """Update matching documents.
19971997
1998- .. note::
1999-
2000- In edge/vertex collections, this method does NOT provide the
2001- transactional guarantees and validations that single update
2002- operation does for graphs. If these properties are required, see
2003- :func:`arango.database.StandardDatabase.begin_batch_execution`
2004- for an alternative approach.
2005-
20061998 :param filters: Document filters.
20071999 :type filters: dict
20082000 :param body: Full or partial document body with the updates.
@@ -2085,14 +2077,6 @@ def replace_many(
20852077 successfully (returns document metadata) and which were not
20862078 (returns exception object).
20872079
2088- .. note::
2089-
2090- In edge/vertex collections, this method does NOT provide the
2091- transactional guarantees and validations that single replace
2092- operation does for graphs. If these properties are required, see
2093- :func:`arango.database.StandardDatabase.begin_batch_execution`
2094- for an alternative approach.
2095-
20962080 :param documents: New documents to replace the old ones with. They must
20972081 contain the "_id" or "_key" fields. Edge documents must also have
20982082 "_from" and "_to" fields.
@@ -2187,14 +2171,6 @@ def replace_match(
21872171 ) -> Result [int ]:
21882172 """Replace matching documents.
21892173
2190- .. note::
2191-
2192- In edge/vertex collections, this method does NOT provide the
2193- transactional guarantees and validations that single replace
2194- operation does for graphs. If these properties are required, see
2195- :func:`arango.database.StandardDatabase.begin_batch_execution`
2196- for an alternative approach.
2197-
21982174 :param filters: Document filters.
21992175 :type filters: dict
22002176 :param body: New document body.
@@ -2263,14 +2239,6 @@ def delete_many(
22632239 successfully (returns document metadata) and which were not
22642240 (returns exception object).
22652241
2266- .. note::
2267-
2268- In edge/vertex collections, this method does NOT provide the
2269- transactional guarantees and validations that single delete
2270- operation does for graphs. If these properties are required, see
2271- :func:`arango.database.StandardDatabase.begin_batch_execution`
2272- for an alternative approach.
2273-
22742242 :param documents: Document IDs, keys or bodies. Document bodies must
22752243 contain the "_id" or "_key" fields.
22762244 :type documents: [str | dict]
@@ -2354,14 +2322,6 @@ def delete_match(
23542322 ) -> Result [int ]:
23552323 """Delete matching documents.
23562324
2357- .. note::
2358-
2359- In edge/vertex collections, this method does NOT provide the
2360- transactional guarantees and validations that single delete
2361- operation does for graphs. If these properties are required, see
2362- :func:`arango.database.StandardDatabase.begin_batch_execution`
2363- for an alternative approach.
2364-
23652325 :param filters: Document filters.
23662326 :type filters: dict
23672327 :param limit: Max number of documents to delete. If the limit is lower
@@ -2428,14 +2388,6 @@ def import_bulk(
24282388 This method is faster than :func:`arango.collection.Collection.insert_many`
24292389 but does not return as many details.
24302390
2431- .. note::
2432-
2433- In edge/vertex collections, this method does NOT provide the
2434- transactional guarantees and validations that single insert
2435- operation does for graphs. If these properties are required, see
2436- :func:`arango.database.StandardDatabase.begin_batch_execution`
2437- for an alternative approach.
2438-
24392391 :param documents: List of new documents to insert. If they contain the
24402392 "_key" or "_id" fields, the values are used as the keys of the new
24412393 documents (auto-generated otherwise). Any "_rev" field is ignored.
@@ -2757,7 +2709,6 @@ def update(
27572709 "returnNew" : return_new ,
27582710 "returnOld" : return_old ,
27592711 "ignoreRevs" : not check_rev ,
2760- "overwrite" : not check_rev ,
27612712 "silent" : silent ,
27622713 }
27632714 if sync is not None :
0 commit comments