You are currently browsing legacy 4.0 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: Deleting entities

Entities can be marked for deletion by using delete method, but will not be removed from server until save_changes is called.


def delete(self, key_or_entity):

def delete_by_entity(self, entity):
entity or key_or_entity entity, str or entity instance of entity to delete or entity Id
expected_change_vector str A change vector to use for concurrency checks

The delete method can be used with entity or str. by calling delete with entity delete_by_entity will be executed

Example 1

employee = session.load("employees/1")

Example 2


Example 3

employee = session.load("employees/1")