Class: RethinkDBAdapter

RethinkDBAdapter


new RethinkDBAdapter(opts)

RethinkDBAdapter class.

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration opts.

Properties
Name Type Argument Default Description
host string <optional>
'localhost'

TODO

port number <optional>
28015

TODO

authKey string <optional>
''

TODO

db string <optional>
'test'

TODO

min number <optional>
10

TODO

max number <optional>
50

TODO

bufferSize number <optional>
10

TODO

Source:
Example
import {DS} from 'js-data'
import RethinkDBAdapter from 'js-data-rethinkdb'
const store = new DS()
const adapter = new RethinkDBAdapter()
store.registerAdapter('rethinkdb', adapter, { 'default': true })

Members


authKey :string

TODO

Type:
  • string
Source:

bufferSize :number

TODO

Type:
  • number
Default Value:
  • 10
Source:

db :string

TODO

Type:
  • string
Default Value:
  • "test"
Source:

debug :boolean

TODO

Type:
  • boolean
Default Value:
  • false
Source:

host :string

TODO

Type:
  • string
Default Value:
  • "localhost"
Source:

max :number

TODO

Type:
  • number
Default Value:
  • 50
Source:

min :number

TODO

Type:
  • number
Default Value:
  • 10
Source:

port :number

TODO

Type:
  • number
Default Value:
  • 10
Source:

raw :boolean

TODO

Type:
  • boolean
Default Value:
  • false
Source:

returnDeletedIds :boolean

TODO

Type:
  • boolean
Default Value:
  • false
Source:

Methods


afterCreate()

Source:

afterCreateMany()

Source:

afterDestroy()

Source:

afterDestroyAll()

Source:

afterFind()

Source:

afterFindAll()

Source:

afterUpdate()

Source:

afterUpdateAll()

Source:

afterUpdateMany()

Source:

beforeCreate()

Source:

beforeCreateMany()

Source:

beforeDestroy()

Source:

beforeDestroyAll()

Source:

beforeFind()

Source:

beforeFindAll()

Source:

beforeUpdate()

Source:

beforeUpdateAll()

Source:

beforeUpdateMany()

Source:

create(mapper, props, opts)

Create a new record.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

props Object

The record to be created.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

Source:
Returns:
Type
Promise

createMany(mapper, props, opts)

Create multiple records in a single batch.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

props Object

The records to be created.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

Source:
Returns:
Type
Promise

dbg()

Source:

destroy(mapper, id, opts)

Destroy the record with the given primary key.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

id string | number

Primary key of the record to destroy.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

returnDeletedIds boolean <optional>
false

Whether to return the primary keys of any deleted records.

Source:
Returns:
Type
Promise

destroyAll(mapper, query, opts)

Destroy the records that match the selection query.

Parameters:
Name Type Argument Description
mapper Object

the mapper.

query Object <optional>

Selection query.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

returnDeletedIds boolean <optional>
false

Whether to return the primary keys of any deleted records.

Source:
Returns:
Type
Promise

find(mapper, id, opts)

Retrieve the record with the given primary key.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

id string | number

Primary key of the record to retrieve.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

with Array.<string> <optional>
[]

TODO

Source:
Returns:
Type
Promise

findAll(mapper, query, opts)

Retrieve the records that match the selection query.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

query Object

Selection query.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

with Array.<string> <optional>
[]

TODO

Source:
Returns:
Type
Promise

getRaw()

TODO

Source:

loadBelongsTo()

TODO

Source:
Returns:
Type
Promise

loadHasMany()

TODO

Source:
Returns:
Type
Promise

loadHasOne()

TODO

Source:
Returns:
Type
Promise

log()

TODO

Source:

makeBelongsToForeignKey()

TODO

Source:
Returns:
Type
*

makeHasManyForeignKey()

TODO

There may be reasons why you may want to override this method, like when the id of the parent doesn't exactly match up to the key on the child.

Source:
Returns:
Type
*

update(mapper, id, props, opts)

Apply the given update to the record with the specified primary key.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

id string | number

The primary key of the record to be updated.

props Object

The update to apply to the record.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

Source:
Returns:
Type
Promise

updateAll(mapper, props, query, opts)

Apply the given update to all records that match the selection query.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

props Object

The update to apply to the selected records.

query Object <optional>

Selection query.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

Source:
Returns:
Type
Promise

updateMany(mapper, records, opts)

Update the given records in a single batch.

Parameters:
Name Type Argument Description
mapper Object

The mapper.

records Array.<Object>

The records to update.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
raw boolean <optional>
false

TODO

Source:
Returns:
Type
Promise