# Exercises

## Exercise 1

* Suggest that which documents are not inserted

{% code title="without\_transaction.py" %}

```python
col.insert_one({'_id': 0})
col.insert_one({'_id': 1})
col.insert_one({'_id': 1})
col.insert_one({'_id': 2})
```

{% endcode %}

{% code title="with\_transaction.py" %}

```python
with client.start_session() as s:
    s.start_transaction()
    
    col.insert_one({"_id" : 0}, session=s)
    col.insert_one({"_id" : 1}, session=s)
    col.insert_one({"_id" : 1}, session=s)
    col.insert_one({"_id" : 2}, session=s)
    
    s.commit_transaction()
```

{% endcode %}
