Skip to main content

Home > git-documentdb > GitDocumentDB > open

GitDocumentDB.open() method#

Open or create a Git repository

Signature:
open(openOptions?: OpenOptions): Promise<DatabaseOpenResult>;

Parameters#

ParameterTypeDescription
openOptionsOpenOptions
Returns:

Promise<DatabaseOpenResult >

Remarks#

  • Create a new Git repository if a dbName specified in the constructor does not exist.

  • GitDocumentDB creates a legitimate Git repository and unique metadata under '.gitddb/'.

  • '.gitddb/' keeps DatabaseInfo for combining databases, checking schema and migration.

  • GitDocumentDB can also load a Git repository that is created by other apps. It almost works; however, correct behavior is not guaranteed if it does not have a valid '.gitddb/'.

Exceptions#

Err.DatabaseClosingError

Err.RepositoryNotFoundError may occurs when openOptions.createIfNotExists is false.

# Errors from _createRepository

# Errors from putWorker