Collection Session Storage
const collectionStorage = require('@arangodb/foxx/sessions/storages/collection');
The collection session storage persists sessions to a collection in the database.
Creating a storage
Creates a Storage that can be used in the sessions middleware.
An object with the following properties:
The collection that should be used to persist the sessions. If a string is passed instead of a collection it is assumed to be the fully qualified name of a collection in the current database.
60 * 60)
The time in seconds since the last update until a session will be considered expired.
Whether expired sessions should be removed from the collection when they are accessed instead of simply being ignored.
Whether sessions should be updated in the collection every time they are accessed to keep them from expiring. Disabling this option will improve performance but means you will have to take care of keeping your sessions alive yourself.
If a string or collection is passed instead of an options object, it will be interpreted as the collection option.
Removes all expired sessions from the collection. This method should be called even if the pruneExpired option is enabled to clean up abandoned sessions.
Returns an array of the keys of all sessions that were removed.
Saves (replaces) the given session object in the collection. This method needs to be invoked explicitly after making changes to the session or the changes will not be persisted. Assigns a new
_key to the session if it previously did not have one.
A session object.
Returns the modified session.
Removes the session from the collection. Has no effect if the session was already removed or has not yet been saved to the collection (i.e. has no
A session object.
true if the session was removed or
false if it had no effect.