diff --git a/docs/pregel.rst b/docs/pregel.rst index 5464c2f4..5aad7abe 100644 --- a/docs/pregel.rst +++ b/docs/pregel.rst @@ -12,7 +12,7 @@ iterative graph processing. For more information, refer to `ArangoDB manual`_. **Example:** -.. testcode:: +.. code-block:: python from arango import ArangoClient diff --git a/docs/transaction.rst b/docs/transaction.rst index 66fb50c8..8bdeb18d 100644 --- a/docs/transaction.rst +++ b/docs/transaction.rst @@ -68,6 +68,13 @@ logical unit of work (ACID compliant). assert '_rev' in txn_col.insert({'_key': 'Lily'}) assert len(txn_col) == 6 + # Abort the transaction + txn_db.abort_transaction() + assert 'Kate' not in col + assert 'Mike' not in col + assert 'Lily' not in col + assert len(col) == 3 # transaction is aborted so txn_col cannot be used + # Fetch an existing transaction. Useful if you have received a Transaction ID # from some other part of your system or an external system. original_txn = db.begin_transaction(write='students') @@ -76,13 +83,7 @@ logical unit of work (ACID compliant). txn_db = db.fetch_transaction(original_txn.transaction_id) txn_col = txn_db.collection('students') assert '_rev' in txn_col.insert({'_key': 'Alya'}) - - # Abort the transaction txn_db.abort_transaction() - assert 'Kate' not in col - assert 'Mike' not in col - assert 'Lily' not in col - assert len(col) == 3 # transaction is aborted so txn_col cannot be used See :ref:`TransactionDatabase` for API specification.