Database adapters

  1. Available adapters
    1. MemoryDB
    2. ShareDBMongo
    3. ShareDBMingoMemory
    4. ShareDBPostgres
  2. Usage

The database adapter is responsible for persisting document contents and ops.

Available adapters

MemoryDB

ShareDB ships with an in-memory, non-persistent database. This is useful for testing. It has no query support.

MemoryDB does not persist its data between app restarts, and is not suitable for use in a Production environment.

ShareDBMongo

sharedb-mongo is backed by MongoDB, with full query support.

ShareDBMingoMemory

sharedb-mingo-memory is an in-memory database that implements a subset of Mongo operations, including queries. This can be useful for testing against a MongoDB-like ShareDB instance.

ShareDBPostgres

sharedb-postgres is backed by PostgreSQL, and has no query support.

Usage

An instance of a database adapter should be provided to the Backend() constructor’s db option:

const backend = new Backend({
  db: new MemoryDB(),
})