function

Open

func Open( ctx context.Context, databaseURL string, ) (*Store, error)

Open a verified-TLS MongoDB replica-set database with bounded defaults.

Source adapters/mongodb/mongodb.go:91

@param ctx
The ctx value.
@param databaseURL
The databaseURL value.
@returns
The declared result.

The URL must select one database. Open checks for a writable replica-set primary with logical sessions but does not create collections, indexes, or migration state.

Example

go
backend, err := mongodb.Open(ctx, os.Getenv("DATABASE_URL"))
if err != nil {
  return err
}
defer backend.Close()

Related types

  • Store

    A replica-set implementation of Ridu’s document, snapshot, auth, preference, task, lock, upload, readiness, and migration contracts.