# Class: Ottoman

# Hierarchy

  • Ottoman

# Methods

# closeConnection

closeConnection(): void

Close Couchbase connection

Returns: void

# connect

connect(connectOptions: ConnectOptions | string): ConnectionManager

Connect to Couchbase server


 import { connect } from "ottoman";
 const connection = connect("couchbase://localhost/travel-sample@admin:password");


Name Type
connectOptions ConnectOptions | string

Returns: ConnectionManager

# getCollection

getCollection(collectionName?: undefined | string): any

Gets a given collection from default connection or returns default collection if collectionName is undefined


Name Type
collectionName? undefined | string

Returns: any

# getConnections

getConnections(): ConnectionManager[]

Returns all active connections

Returns: ConnectionManager[]

# getDefaultConnection

getDefaultConnection(): ConnectionManager

Returns default connection

Returns: ConnectionManager

# model

model(name: string, schema: Schema | Record‹string, any›, options: ModelOptions): object & object

Creates a model from a given name, from default connection


import { connect, model } from "ottoman";

const User = model('User', { name: String });


Name Type Default
name string -
schema Schema | Record‹string, any› -
options ModelOptions {}

Returns: object & object

# start

start(params: object): Promise‹void›

Ensure that Ottoman start correcty


Name Type Default
params object {}

Returns: Promise‹void›