The [SessionFactory] that created this [Session].
Clears the Session, detaching all managed entities.
Called after the Session has been cleared.
Flushes any changes to the database and closes the Session. Calling operations on a closed Session will result in an error.
Called after the Session has been closed.
Checks if an entity is contained in the Session.
The entity to check.
Detaches an entity from the Session making it unmanaged. Any changes to the entity will not be persisted.
The entity to detach.
Called after the entity has been detached.
Check by identifier if an entity exists.
The constructor for the entity to find.
The identifier for the entity.
Called with a boolean indicating if an entity with exists or not. Note that if an entity is pending removal then the value will be false.
Fetches an entity reference from the database.
The entity reference to fetch.
Called with the fetched entity.
Fetches entity references at the specified path(s) on the given entity.
The entity
The path(s) to check. Uses the same dot notation that MongoDB uses for queries.
Called after any entity references have been fetched.
Finds an entity by identifier.
The constructor for the entity to find.
The identifier for the entity.
Called with the entity.
Synchronizes the Session with the database, writing any changes.
Called after the changes have been written to the database.
Gets a reference to an entity without making a request to the database.
The constructor for the entity.
The identifier for the entity.
Gets the version number of an entity. Returns null
if the version cannot be determined.
The entity to get the version for.
Adds an event listener.
The event to listen for.
The listener function.
Refreshes an entity state from database. Any changes to the entity are discarded.
The entity to refresh.
Called after the entity has been refreshed.
Removes an entity from the Session. The entity is not actually removed from the database util the Session is flushed.
The entity to remove.
Called after the entity has been removed from the Session.
Saves an entity to the Session. If the entity is new then it becomes managed. If the entity is already managed then it is flagged for dirty check. The entity is not actually saved to the database until the Session is flushed.
The entity to save.
Called after the entity has been added to the Session.
Converts an entity to a document, the same document that is stored in the database. The document is suitable for serialization to JSON.
The entity to convert to a document.
Optional callback is called with serialized document. If callback is provided, any errors encountered during
writing the document are passed to the callback. If a callback is not provided and errors are encountered during writing the
document, null
is returned.
Waits for pending operations on the Session to complete.
Called after all pending operations on the Session have completed.
Generated using TypeDoc
The primary interface used to interact with the database. The Session is a Unit of Work that keeps track of changes until they are synchronized with the database by calling flush or close.