new DocumentDBAdapter(opts)
DocumentDBAdapter class.
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object |
<optional> |
Configuration options. Properties
|
Source |
---|
src/index.js, line 103 |
// Use Container instead of DataStore on the server
import { Container } from 'js-data';
import { DocumentDBAdapter } from 'js-data-documentdb';
// Create a store to hold your Mappers
const store = new Container();
// Create an instance of DocumentDBAdapter with default settings
const adapter = new DocumentDBAdapter({
documentOpts: {
db: 'mydb',
urlConnection: process.env.DOCUMENT_DB_ENDPOINT,
auth: {
masterKey: process.env.DOCUMENT_DB_KEY
}
}
});
// Mappers in "store" will use the DocumentDB adapter by default
store.registerAdapter('documentdb', adapter, { 'default': true });
// Create a Mapper that maps to a "user" table
store.defineMapper('user');
Extends
This class extends the Adapter class.Members
-
client
-
The DocumentDB client used by this adapter. Use this directly when you need to write custom queries.
DetailsType Source Object src/index.js, line 148 Examplesimport { DocumentDBAdapter } from 'js-data-documentdb'; const adapter = new DocumentDBAdapter() adapter.client.createDatabase('foo', function (err, db) {...});
import { DocumentDBAdapter } from 'js-data-documentdb'; const adapter = new DocumentDBAdapter({ documentOpts: { db: 'mydb', urlConnection: process.env.DOCUMENT_DB_ENDPOINT, auth: { masterKey: process.env.DOCUMENT_DB_KEY } } }); adapter.client.createDatabase('foo', function (err, db) {...});
import { DocumentClient } from 'documentdb'; import { DocumentDBAdapter } from 'js-data-documentdb'; const client = new DocumentClient(...) const adapter = new DocumentDBAdapter({ client: client }); adapter.client.createDatabase('foo', function (err, db) {...});
-
debug
-
Whether to log debugging information.
DetailsType Default value Source Boolean false
node_modules/js-data-adapter/src/index.js, line 74 - Inherited From:
-
documentOpts
-
Options to pass to a new
DocumentClient
instance, if one was not provided at DocumentDBAdapter#client. See the DocumentClient API for instance options.DetailsType Source See Object src/index.js, line 229 Properties:
Name Type Argument Description db
String The default database to use.
urlConnection
String The service endpoint to use to create the client.
auth
Object An object that is used for authenticating requests and must contains one of the auth options.
Properties
Name Type Description masterkey
Object The authorization master key to use to create the client. Keys for the object are resource Ids and values are the resource tokens.
resourceTokens
Array.<Object> An object that contains resources tokens. Keys for the object are resource Ids and values are the resource tokens.
permissionFeed
String An array of Permission objects.
connectionPolicy
String <optional>
An instance of ConnectionPolicy class. This parameter is optional and the default connectionPolicy will be used if omitted.
consistencyLevel
String <optional>
An optional parameter that represents the consistency level. It can take any value from ConsistencyLevel.
-
feedOpts
-
Default options to pass to DocumentClient#queryDocuments.
DetailsType Default value Source Object {}
src/index.js, line 209 -
operators
-
Override the default predicate functions for the specified operators.
DetailsType Default value Source Object {}
src/index.js, line 219 -
raw
-
Whether to return a more detailed response object.
DetailsType Default value Source Boolean false
node_modules/js-data-adapter/src/index.js, line 83 - Inherited From:
-
requestOpts
-
Default options to pass to DocumentClient requests.
DetailsType Default value Source Object {}
src/index.js, line 199
Methods
-
<static> extend(props, classProps)
-
Create a subclass of this DocumentDBAdapter:
Method parameters:Name Type Argument Default Description props
Object <optional>
{} Properties to add to the prototype of the subclass.
Properties
Name Type Argument Description constructor
Object <optional>
Provide a custom constructor function to be used as the subclass itself.
classProps
Object <optional>
{} Static properties to add to the subclass.
Return value:Type Description Constructor Subclass of this DocumentDBAdapter class.
DetailsSince Source 3.0.0 src/index.js, line 1116 Example// Normally you would do: import {DocumentDBAdapter} from 'js-data-documentdb' const JSDataDocumentDB = require('js-data-documentdb') const { DocumentDBAdapter } = JSDataDocumentDB console.log('Using JSDataDocumentDB v' + JSDataDocumentDB.version.full) // Extend the class using ES2015 class syntax. class CustomDocumentDBAdapterClass extends DocumentDBAdapter { foo () { return 'bar' } static beep () { return 'boop' } } const customDocumentDBAdapter = new CustomDocumentDBAdapterClass({ documentOpts: { db: 'mydb', urlConnection: process.env.DOCUMENT_DB_ENDPOINT, auth: { masterKey: process.env.DOCUMENT_DB_KEY } } }) console.log(customDocumentDBAdapter.foo()) console.log(CustomDocumentDBAdapterClass.beep()) // Extend the class using alternate method. const OtherDocumentDBAdapterClass = DocumentDBAdapter.extend({ foo () { return 'bar' } }, { beep () { return 'boop' } }) const otherDocumentDBAdapter = new OtherDocumentDBAdapterClass({ documentOpts: { db: 'mydb', urlConnection: process.env.DOCUMENT_DB_ENDPOINT, auth: { masterKey: process.env.DOCUMENT_DB_KEY } } }) console.log(otherDocumentDBAdapter.foo()) console.log(OtherDocumentDBAdapterClass.beep()) // Extend the class, providing a custom constructor. function AnotherDocumentDBAdapterClass () { DocumentDBAdapter.call(this) this.created_at = new Date().getTime() } DocumentDBAdapter.extend({ constructor: AnotherDocumentDBAdapterClass, foo () { return 'bar' } }, { beep () { return 'boop' } }) const anotherDocumentDBAdapter = new AnotherDocumentDBAdapterClass({ documentOpts: { db: 'mydb', urlConnection: process.env.DOCUMENT_DB_ENDPOINT, auth: { masterKey: process.env.DOCUMENT_DB_KEY } } }) console.log(anotherDocumentDBAdapter.created_at) console.log(anotherDocumentDBAdapter.foo()) console.log(AnotherDocumentDBAdapterClass.beep())
-
afterCount(mapper, props, opts, response)
-
Lifecycle method method called by count.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes count to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the count.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to count.props
Object The
props
argument passed to count.opts
Object The
opts
argument passed to count.response
Object | Response Count or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 115 - Inherited From:
Properties:
Name Type Description opts.op
String afterCount
-
afterCreate(mapper, props, opts, response)
-
Lifecycle method method called by create.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes create to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the created record.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to create.props
Object The
props
argument passed to create.opts
Object The
opts
argument passed to create.response
Object | Response Created record or Response, depending on the value of
opts.raw
.DetailsSource Overrides node_modules/js-data-adapter/src/index.js, line 138 Adapter#afterCreate - Inherited From:
Properties:
Name Type Description opts.op
String afterCreate
-
afterDestroy(mapper, id, opts, response)
-
Lifecycle method method called by destroy.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will beundefined
.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to destroy.id
String | Number The
id
argument passed to destroy.opts
Object The
opts
argument passed to destroy.response
undefined | Response undefined
or Response, depending on the value ofopts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 184 - Inherited From:
Properties:
Name Type Description opts.op
String afterDestroy
-
afterDestroyAll(mapper, query, opts, response)
-
Lifecycle method method called by destroyAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will beundefined
.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to destroyAll.query
Object The
query
argument passed to destroyAll.opts
Object The
opts
argument passed to destroyAll.response
undefined | Response undefined
or Response, depending on the value ofopts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 207 - Inherited From:
Properties:
Name Type Description opts.op
String afterDestroyAll
-
afterFind(mapper, id, opts, response)
-
Lifecycle method method called by find.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes find to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the found record, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to find.id
String | Number The
id
argument passed to find.opts
Object The
opts
argument passed to find.response
Object | Response The found record or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 230 - Inherited From:
Properties:
Name Type Description opts.op
String afterFind
-
afterFindAll(mapper, query, opts, response)
-
Lifecycle method method called by findAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the found records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to findAll.query
Object The
query
argument passed to findAll.opts
Object The
opts
argument passed to findAll.response
Array.<Object> | Response The found records or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 253 - Inherited From:
Properties:
Name Type Description opts.op
String afterFindAll
-
afterSum(mapper, field, query, opts, response)
-
Lifecycle method method called by sum.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes sum to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the sum.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to sum.field
String The
field
argument passed to sum.query
Object The
query
argument passed to sum.opts
Object The
opts
argument passed to sum.response
Object | Response Count or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 276 - Inherited From:
Properties:
Name Type Description opts.op
String afterSum
-
afterUpdate(mapper, id, props, opts, response)
-
Lifecycle method method called by update.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes update to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated record.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to update.id
String | Number The
id
argument passed to update.props
Object The
props
argument passed to update.opts
Object The
opts
argument passed to update.response
Object | Response The updated record or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 300 - Inherited From:
Properties:
Name Type Description opts.op
String afterUpdate
-
afterUpdateAll(mapper, props, query, opts, response)
-
Lifecycle method method called by updateAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to updateAll.props
Object The
props
argument passed to updateAll.query
Object The
query
argument passed to updateAll.opts
Object The
opts
argument passed to updateAll.response
Array.<Object> | Response The updated records or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 324 - Inherited From:
Properties:
Name Type Description opts.op
String afterUpdateAll
-
afterUpdateMany(mapper, records, opts, response)
-
Lifecycle method method called by updateMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
If
opts.raw
istrue
thenresponse
will be a detailed response object, otherwiseresponse
will be the updated records, if any.response
may be modified. You can also re-assignresponse
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to updateMany.records
Array.<Object> The
records
argument passed to updateMany.opts
Object The
opts
argument passed to updateMany.response
Array.<Object> | Response The updated records or Response, depending on the value of
opts.raw
.DetailsSource node_modules/js-data-adapter/src/index.js, line 348 - Inherited From:
Properties:
Name Type Description opts.op
String afterUpdateMany
-
beforeCount(mapper, query, opts)
-
Lifecycle method method called by count.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes count to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to count.query
Object The
query
argument passed to count.opts
Object The
opts
argument passed to count.DetailsSource node_modules/js-data-adapter/src/index.js, line 371 - Inherited From:
Properties:
Name Type Description opts.op
String beforeCount
-
beforeCreate(mapper, props, opts)
-
Lifecycle method method called by create.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes create to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to create.props
Object The
props
argument passed to create.opts
Object The
opts
argument passed to create.DetailsSource node_modules/js-data-adapter/src/index.js, line 389 - Inherited From:
Properties:
Name Type Description opts.op
String beforeCreate
-
beforeCreateMany(mapper, props, opts)
-
Lifecycle method method called by createMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to createMany.props
Array.<Object> The
props
argument passed to createMany.opts
Object The
opts
argument passed to createMany.DetailsSource node_modules/js-data-adapter/src/index.js, line 409 - Inherited From:
Properties:
Name Type Description opts.op
String beforeCreateMany
-
beforeDestroy(mapper, id, opts)
-
Lifecycle method method called by destroy.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to destroy.id
String | Number The
id
argument passed to destroy.opts
Object The
opts
argument passed to destroy.DetailsSource node_modules/js-data-adapter/src/index.js, line 429 - Inherited From:
Properties:
Name Type Description opts.op
String beforeDestroy
-
beforeDestroyAll(mapper, query, opts)
-
Lifecycle method method called by destroyAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to destroyAll.query
Object The
query
argument passed to destroyAll.opts
Object The
opts
argument passed to destroyAll.DetailsSource node_modules/js-data-adapter/src/index.js, line 447 - Inherited From:
Properties:
Name Type Description opts.op
String beforeDestroyAll
-
beforeFind(mapper, id, opts)
-
Lifecycle method method called by find.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes find to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to find.id
String | Number The
id
argument passed to find.opts
Object The
opts
argument passed to find.DetailsSource node_modules/js-data-adapter/src/index.js, line 465 - Inherited From:
Properties:
Name Type Description opts.op
String beforeFind
-
beforeFindAll(mapper, query, opts)
-
Lifecycle method method called by findAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to findAll.query
Object The
query
argument passed to findAll.opts
Object The
opts
argument passed to findAll.DetailsSource node_modules/js-data-adapter/src/index.js, line 483 - Inherited From:
Properties:
Name Type Description opts.op
String beforeFindAll
-
beforeSum(mapper, query, opts)
-
Lifecycle method method called by sum.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes sum to wait for the Promise to resolve before continuing.
A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to sum.query
Object The
query
argument passed to sum.opts
Object The
opts
argument passed to sum.DetailsSource node_modules/js-data-adapter/src/index.js, line 501 - Inherited From:
Properties:
Name Type Description opts.op
String beforeSum
-
beforeUpdate(mapper, id, props, opts)
-
Lifecycle method method called by update.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes update to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to update.id
String | Number The
id
argument passed to update.props
Object The
props
argument passed to update.opts
Object The
opts
argument passed to update.DetailsSource node_modules/js-data-adapter/src/index.js, line 519 - Inherited From:
Properties:
Name Type Description opts.op
String beforeUpdate
-
beforeUpdateAll(mapper, props, query, opts)
-
Lifecycle method method called by updateAll.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to updateAll.props
Object The
props
argument passed to updateAll.query
Object The
query
argument passed to updateAll.opts
Object The
opts
argument passed to updateAll.DetailsSource node_modules/js-data-adapter/src/index.js, line 540 - Inherited From:
Properties:
Name Type Description opts.op
String beforeUpdateAll
-
beforeUpdateMany(mapper, props, opts)
-
Lifecycle method method called by updateMany.
Override this method to add custom behavior for this lifecycle hook.
Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
props
may be modified. You can also re-assignprops
to another value by returning a different value or a Promise that resolves to a different value.A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
Method parameters:Name Type Description mapper
Object The
mapper
argument passed to updateMany.props
Array.<Object> The
props
argument passed to updateMany.opts
Object The
opts
argument passed to updateMany.DetailsSource node_modules/js-data-adapter/src/index.js, line 561 - Inherited From:
Properties:
Name Type Description opts.op
String beforeUpdateMany
-
count(mapper, query, opts)
-
Return the number of records that match the selection query.
Method parameters:Name Type Argument Description mapper
Object the mapper.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description operators
Object <optional>
Override the default predicate functions for specified operators.
raw
Boolean <optional>
false Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 739 Adapter#count -
create(mapper, props, opts)
-
Create a new record.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 768 Adapter#create -
createMany(mapper, props, opts)
-
Create multiple records in a single batch.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 789 Adapter#createMany -
destroy(mapper, id, opts)
-
Destroy the record with the given primary key.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 810 Adapter#destroy -
destroyAll(mapper, query, opts)
-
Destroy the records that match the selection query.
Method parameters:Name Type Argument Description mapper
Object the mapper.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description feedOpts
Object <optional>
Options to pass to the DocumentClient#queryDocuments.
operators
Object <optional>
Override the default predicate functions for specified operators.
raw
Boolean <optional>
false Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 830 Adapter#destroyAll -
find(mapper, id, opts)
-
Retrieve the record with the given primary key.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
with
Array.<String> <optional>
[] Relations to eager load.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 860 Adapter#find -
findAll(mapper, query, opts)
-
Retrieve the records that match the selection query.
Method parameters:Name Type Argument Description mapper
Object The mapper.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description feedOpts
Object <optional>
Options to pass to the DocumentClient#queryDocuments.
fields
Array.<String> <optional>
Choose which fields should be returned from the SQL query, e.g. ["id", "name"].
operators
Object <optional>
Override the default predicate functions for specified operators.
raw
Boolean <optional>
false Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
select
String <optional>
Override the SELECT string in the resulting SQL query, e.g. "users.id,users.name".
with
Array.<String> <optional>
[] Relations to eager load.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 881 Adapter#findAll -
getOperator(operator, opts)
-
Resolve the predicate function for the specified operator based on the given options and this adapter's settings.
Method parameters:Name Type Argument Description operator
String The name of the operator.
opts
Object <optional>
Configuration options.
Properties
Name Type Argument Description operators
Object <optional>
Override the default predicate functions for specified operators.
Return value:Type Description * The predicate function for the specified operator.
DetailsSource src/index.js, line 916 -
getOpt(opt, opts)
-
Resolve the value of the specified option based on the given options and this adapter's settings. Override with care.
Method parameters:Name Type Argument Description opt
String The name of the option.
opts
Object <optional>
Configuration options.
Return value:Type Description * The value of the specified option.
DetailsSource node_modules/js-data-adapter/src/index.js, line 989 - Inherited From:
-
getQuerySpec(mapper, query, opts)
-
Generate the querySpec object for DocumentClient#queryDocuments.
Method parameters:Name Type Argument Description mapper
Object The mapper.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Description operators
Object <optional>
Override the default predicate functions for specified operators.
DetailsSource src/index.js, line 550 -
loadBelongsTo()
-
Load a belongsTo relationship.
Override with care.
Return value:Type Description Promise Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 795 - Inherited From:
-
loadHasMany()
-
Load a hasMany relationship.
Override with care.
Return value:Type Description Promise Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1004 - Inherited From:
-
loadHasOne()
-
Load a hasOne relationship.
Override with care.
Return value:Type Description Promise Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1138 - Inherited From:
-
makeBelongsToForeignKey()
-
Return the foreignKey from the given record for the provided relationship.
Override with care.
Return value:Type Description * Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1207 - Inherited From:
-
makeHasManyForeignKey()
-
Return the foreignKey from the given record for the provided relationship.
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.
Override with care.
Return value:Type Description * Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1161 - Inherited From:
-
makeHasManyForeignKeys()
-
Return the foreignKeys from the given record for the provided relationship.
Override with care.
Return value:Type Description * Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1194 - Inherited From:
-
makeHasManyLocalKeys()
-
Return the localKeys from the given record for the provided relationship.
Override with care.
Return value:Type Description * Unspecified DetailsSource node_modules/js-data-adapter/src/index.js, line 1177 - Inherited From:
-
respond(response, opts)
-
Method parameters:
Name Type Description response
Object Response object.
opts
Object Configuration options. return {Object} If
opts.raw == true
then returnresponse
, else returnresponse.data
.DetailsSource node_modules/js-data-adapter/src/index.js, line 1270 - Inherited From:
-
sum(mapper, field, query, opts)
-
Return the sum of the specified field of records that match the selection query.
Method parameters:Name Type Argument Description mapper
Object The mapper.
field
String The field to sum.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description feedOpts
Object <optional>
Options to pass to the DocumentClient#queryDocuments.
operators
Object <optional>
Override the default predicate functions for specified operators.
raw
Boolean <optional>
false Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 935 Adapter#sum -
update(mapper, id, props, opts)
-
Apply the given update to the record with the specified primary key.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 967 Adapter#update -
updateAll(mapper, props, query, opts)
-
Apply the given update to all records that match the selection query.
Method parameters:Name Type Argument Description mapper
Object The mapper.
props
Object The update to apply to the selected records.
query
Object <optional>
Selection query.
Properties
Name Type Argument Description where
Object <optional>
Filtering criteria.
orderBy
String | Array <optional>
Sorting criteria.
sort
String | Array <optional>
Same as
query.sort
.limit
Number <optional>
Limit results.
skip
Number <optional>
Offset results.
offset
Number <optional>
Same as
query.skip
.opts
Object <optional>
Configuration options.
Properties
Name Type Argument Default Description feedOpts
Object <optional>
Options to pass to the DocumentClient#queryDocuments.
operators
Object <optional>
Override the default predicate functions for specified operators.
raw
Boolean <optional>
false Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 989 Adapter#updateAll -
updateMany(mapper, records, opts)
-
Update the given records in a single batch.
Method 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 Whether to return a more detailed response object.
requestOpts
Object <optional>
Options to pass to the DocumentClient request.
Return value:Type Description Promise Unspecified DetailsSource Overrides src/index.js, line 1021 Adapter#updateMany