# Class: Ottoman

# Hierarchy

  • Ottoman

# Methods

# closeConnection

closeConnection(): void

Close Couchbase connection

Returns: void


# connect

connect(connectOptions: ConnectOptions | string): ConnectionManager

Connect to Couchbase server

example

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

Parameters:

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

Parameters:

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

example

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

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

Parameters:

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

Parameters:

Name Type Default
params object {}

Returns: Promise‹void›