Class: CbStoreAdapter

CbStoreAdapter

new CbStoreAdapter(bucket)

The Couchbase store adapter implements an Ottoman StoreAdapter suitable for using Ottoman with Couchbase Server.

Parameters:
Name Type Description
bucket

Methods

count(type, modelName, options, callback)

Performs a count of the documents matching a particular filter expression and model type.

Parameters:
Name Type Description
type string

The type of index to use for the search. Currently unused (always N1QL).

modelName string

The name of the model to look for.

options Object
Properties
Name Type Description
filter Object

The filter expression for filtering documents for counting.

callback StoreAdapter~SearchCallback

createIndex(type, modelName, name, fields, callback)

Creates an index of the specified type. This simply records the data for the specified index, the bulk of the creation work is actually done in the ensureIndices method.

Parameters:
Name Type Description
type string

The type of index to create. This value is passed through from the type field specified in a schema's index definition.

modelName string

The name of the model this index belongs to.

name string

The name of the index to created.

fields Array.<string>

A list of field names that should be indexed.

callback StoreAdapter~CreateIndexCallback

ensureIndices(callback)

Ensures that all indexes specified by createIndex calls are created and available on the server.

Parameters:
Name Type Description
callback StoreAdapter~EnsureCallback

find(type, modelName, options, callback)

Performs a generic find by a filter expression.

Parameters:
Name Type Description
type string

The type of index to use for the search. Currently unused (always N1QL).

modelName string

The name of the model to search within.

options Object
Properties
Name Type Description
filter Object

The filter expression to filter with.

limit number

The maximum number of results to return.

skip number

The number of results to skip before returning results.

sort string | Array.<string>

A field name or list of field names to sort the results by.

callback StoreAdapter~SearchCallback

get(key, callback)

Retrieves a stored document by it's key.

Parameters:
Name Type Description
key string

The key of the document to retrieve.

callback StoreAdapter~GetCallback

isNotFoundError(err) → {boolean}

Returns whether a particular error is a document not-found error.

Parameters:
Name Type Description
err
Returns:
Type
boolean

remove(key, cas, callback)

Removes a document using it's key.

Parameters:
Name Type Description
key

The key of the document to remove.

cas Object

If not-null, an opaque CAS value to verify before the operation succeeds.

callback StoreAdapter~RemoveCallback

searchIndex(type, modelName, name, options, key, range, start, end, callback)

Performs a search against an index.

Parameters:
Name Type Description
type string

The type of index that we are searching.

modelName string

The model that this index is related to.

name string

The name of the index to search

options Object
key string

The specific key we want to locate in the index.

range Object
start string

The starting key of a key-range to search.

end string

The ending key of a key-range to search.

callback StoreAdapter~SearchCallback

store(key, data, cas, callback)

Stores a document using it's key for later retrieval.

Parameters:
Name Type Description
key string

The key of the document to store.

data Object

The data to store for the document.

cas Object

If not-null, an opaque CAS value to verify before the operation succeeds.

callback StoreAdapter~StoreCallback