Global

Members

(constant) EXAMPLE

Default changeset schema for sql databases

Source:

Methods

_CREATE(options, cb)

Convenience method for .create mongoose method

Parameters:
Name Type Description
options Object

Configurable options for mongo create

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

newdoc Object | Array.<Object> <optional>
options

The document that should be created. If newdoc option is not passed it is assumed that the entire options object is the document

bulk_create Boolean

If true and options.newdoc is an array each index will be treated as an individual document and be bulk inserted

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

xss_whitelist Object <optional>
this.xss_whitelist

XSS white-list configuration for xss npm module

cb function

Callback function for create

Source:

_CREATE(options, cb)

Convenience method for .create lowkie method

Parameters:
Name Type Description
options Object

Configurable options for loki create

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

newdoc Object | Array.<Object> <optional>
options

The document that should be created. If newdoc option is not passed it is assumed that the entire options object is the document

bulk_create Boolean

If true and options.newdoc is an array each index will be treated as an individual document and be bulk inserted

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

xss_whitelist Object <optional>
this.xss_whitelist

XSS white-list configuration for xss npm module

cb function

Callback function for create

Source:

_CREATE(options, cb)

Convenience method for .create sequelize method

Parameters:
Name Type Description
options Object

Configurable options for SQL create

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

newdoc Object | Array.<Object> <optional>
options

The document that should be created. If newdoc option is not passed it is assumed that the entire options object is the document. A bulk create will be done if newdoc is an array and bulk_create option is true

bulk_create Boolean

If true and options.newdoc is an array each index will be treated as an individual document and be bulk inserted (WARNING: Due to limitations in MySQL and other SQL variants bulk creates can't assign auto-incremented ids please use accordingly)

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

xss_whitelist Object <optional>
this.xss_whitelist

XSS white-list configuration for xss npm module

cb function

Callback function for create

Source:

_DELETE(options, cb)

Convenience method for .remove mongoose method

Parameters:
Name Type Description
options Object

Configurable options for mongo delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

deleteid string

The mongo id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

cb function

Callback function for delete

Source:

_DELETE(options, cb)

Convenience method for .remove lowkie method

Parameters:
Name Type Description
options Object

Configurable options for loki delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

deleteid string

The loki id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

cb function

Callback function for delete

Source:

_DELETE(options, cb)

Convenience method for .destroy sequelize method

Parameters:
Name Type Description
options Object

Configurable options for SQL delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

deleteid string

The SQL id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

force Boolean

If true document will always be fully deleted (if paranoid option is set on model this option will override)

cb function

Callback function for delete

Source:

_DELETED(options, cb)

Convenience method for .destroy sequelize method but returns the deleted document

Parameters:
Name Type Description
options Object

Configurable options for SQL delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

deleteid string

The SQL id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

cb function

Callback function for delete

Source:

_DELETED(options, cb)

Convenience method for .remove mongoose method but returns the deleted document

Parameters:
Name Type Description
options Object

Configurable options for mongo delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

deleteid string

The mongo id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

cb function

Callback function for delete

Source:

_DELETED(options, cb)

Convenience method for .remove lowkie method but returns the deleted document

Parameters:
Name Type Description
options Object

Configurable options for loki delete

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

deleteid string

The loki id of the document that should be removed

id string

If options.deleteid is provided this value is ignored - alias for options.deleteid

cb function

Callback function for delete

Source:

_LOAD(options, cb)

Convenience method for .findOne or .findById lowkie methods

Parameters:
Name Type Description
options Object

Configurable options for loki query

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

population Object | string <optional>
this.population

The lowkie population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

docid string <optional>
"_id"

A field that should be queried will default to "_id"

query Object | string | number

If value is an object query will be set to the value otherwise a query will be built based on options.docid and any other value provided in options.query

cb function

Callback function for load

Source:

_LOAD(options, cb)

Convenience method for .findOne sequelize methods

Parameters:
Name Type Description
options Object

Configurable options for mongo query

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

population Object | string <optional>
this.population

An object containing an include property which is an array of table associations for a given sequelize model or just the array of associations (see sequelize documentation for proper configuration)

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

docid string <optional>
"id"

A field that should be queried will default to "id"

query Object | string | number

If value is an object query will be set to the value otherwise a query will be built based on options.docid and any other value provided in options.query

cb function

Callback function for load

Source:

_LOAD(options, cb)

Convenience method for .findOne or .findById mongoose methods

Parameters:
Name Type Description
options Object

Configurable options for mongo query

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

population Object | string <optional>
this.population

The mongoose population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

docid string <optional>
"_id"

A field that should be queried will default to "_id"

query Object | string | number

If value is an object query will be set to the value otherwise a query will be built based on options.docid and any other value provided in options.query

cb function

Callback function for load

Source:

_QUERY(options, cb)

Convenience method for .find loki method

Parameters:
Name Type Description
options Object

Options for the loki query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

The lowkie population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_QUERY(options, cb)

Convenience method for .find mongo method

Parameters:
Name Type Description
options Object

Options for the mongo query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

The mongoose population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_QUERY(options, cb)

Convenience method for .findAll sequelize method

Parameters:
Name Type Description
options Object

Options for the SQL query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

An object containing an include property which is an array of table associations for a given sequelize model or just the array of associations (see sequelize documentation for proper configuration)

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_QUERY_WITH_PAGINATION(options, cb)

Convenience method for .findAll SQL method with built in pagination of data

Parameters:
Name Type Description
options Object

Options for the SQL query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

An object containing an include property which is an array of table associations for a given sequelize model or just the array of associations (see sequelize documentation for proper configuration)

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_QUERY_WITH_PAGINATION(options, cb)

Convenience method for .find mongo method with built in pagination of data

Parameters:
Name Type Description
options Object

Options for the mongo query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

The mongoose population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_QUERY_WITH_PAGINATION(options, cb)

Convenience method for .find loki method with built in pagination of data

Parameters:
Name Type Description
options Object

Options for the loki query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

The lowkie population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for query

Source:

_RAW(options, cb)

Convenience method for .query sequelize method that allows for raw SQL queries

Parameters:
Name Type Description
options Object

Configurable options for raw SQL query

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

query string

Raw query for SQL

raw_query string

Alias for options.query. If options.query is set this option is ignored

raw string

Alias for options.query. If options.query or options.raw_query is set this option is ignored

format_result Boolean | Object

If false result will not be formatted. If a sequelize query type object those rules will be used in formatting. If not false and not a format object the query type will be inferred from the raw query and formatting rules will be applied

cb function

Callback function for raw query

Source:

Convenience method for .find loki method with built in query builder functionality

Parameters:
Name Type Description
options Object

Options for the loki query

Properties
Name Type Attributes Default Description
query Object | string <optional>

The query that should be used for the database search. If this value is a string it will be treated as a delimited list of values to use in query

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

The lowkie population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

search Array.<string> <optional>
this.searchfields

Used in building the query. A separate $or statement is appended into query array for each search field specified ie. ['a','b'] => { $or: [{a: ..., b ...}] }

delimeter string <optional>
"|||"

The value that the query values are delimeted by. If options.query is an object this value is ignored

docid string <optional>
this.docid

When using options.values this specifies the name of the field that should be matched

values string <optional>

A comma separated list of values to be queried against docid or "_id" if docid is not specified

paginate Boolean

If true documents will be returned in a paginated format

cb function

Callback function for query

Source:

Convenience method for .find mongo method with built in query builder functionality

Parameters:
Name Type Description
options Object

Options for the mongo query

Properties
Name Type Attributes Default Description
query Object | string <optional>

The query that should be used for the database search. If this value is a string it will be treated as a delimited list of values to use in query

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

The mongoose population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

search Array.<string> <optional>
this.searchfields

Used in building the query. A separate $or statement is appended into query array for each search field specified ie. ['a','b'] => { $or: [{a: ..., b ...}] }

delimeter string <optional>
"|||"

The value that the query values are delimeted by. If options.query is an object this value is ignored

docid string <optional>
this.docid

When using options.values this specifies the name of the field that should be matched

values string <optional>

A comma separated list of values to be queried against docid or "_id" if docid is not specified

paginate Boolean

If true documents will be returned in a paginated format

cb function

Callback function for query

Source:

Convenience method for .findAll SQL method with built in query builder functionality

Parameters:
Name Type Description
options Object

Options for the SQL query

Properties
Name Type Attributes Default Description
query Object | string <optional>

The query that should be used for the database search. If this value is a string it will be treated as a delimited list of values to use in query

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

pagelength number <optional>
this.pagelength

Defines the max length of each sub-set of data

population Object | string <optional>
this.population

An object containing an include property which is an array of table associations for a given sequelize model or just the array of associations (see sequelize documentation for proper configuration)

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

search Array.<string> <optional>
this.searchfields

Used in building the query. A separate $or statement is appended into query array for each search field specified ie. ['a','b'] => { $or: [{a: ..., b ...}] }

delimeter string <optional>
"|||"

The value that the query values are delimeted by. If options.query is an object this value is ignored

docid string <optional>
this.docid

When using options.values this specifies the name of the field that should be matched

values string <optional>

A comma separated list of values to be queried against docid or "_id" if docid is not specified

paginate Boolean

If true documents will be returned in a paginated format

cb function

Callback function for query

Source:

_STREAM(options, cb)

Convenience method for returning a stream of mongo data

Parameters:
Name Type Description
options Object

Options for the mongo query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

The mongoose population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for stream

Source:

_STREAM(options, cb)

Convenience method for returning a stream of sql data. Since sequelize does not expose a cursor or stream method this is an implementation of a cursor on top of a normal SQL query

Parameters:
Name Type Description
options Object

Options for the SQL query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

An object containing an include property which is an array of table associations for a given sequelize model or just the array of associations (see sequelize documentation for proper configuration)

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for stream

Source:

_STREAM(options, cb)

Convenience method for returning a stream of loki data

Parameters:
Name Type Description
options Object

Options for the loki query

Properties
Name Type Attributes Default Description
query Object <optional>
{}

The query that should be used for the database search

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

sort string <optional>
this.sort

Sorting criteria for query will default to the this.sort value if not defined

limit number <optional>
this.limit

Limits the total returned documents for query will default to the this.limit value if not defined

population Object | string <optional>
this.population

The lowkie population for query will default to the this.population value if not defined

fields Object <optional>
this.fields

The fields that should be returned in query will default to the this.fields value if not defined

skip number <optional>

The number of documents to offset in query

cb function

Callback function for stream

Source:

_UPDATE(options, cb)

Convenience method for .update loki method

Parameters:
Name Type Description
options Object

Configurable options for loki update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updatedated document

id string

The loki _id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

_UPDATE(options, cb)

Convenience method for .update SQL method

Parameters:
Name Type Description
options Object

Configurable options for SQL update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updatedated document

id string

The SQL id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

_UPDATE(options, cb)

Convenience method for .update mongo method

Parameters:
Name Type Description
options Object

Configurable options for mongo update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updatedated document

id string

The mongo _id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

_UPDATE_ALL(options, cb)

Convenience method for .update for multiple document updates

Parameters:
Name Type Description
options Object

Configurable options for SQL update with no limit

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

query Object

Query that should be used in update

updatequery Object <optional>

Alias for options.query if options.query is set this option is ignored

updateattributes Object

A SQL update formatted object

updatedoc Object <optional>

Object specifying fields to update with new values this object will be formatted as a patch update. If options.updateattributes is set this option is ignored

cb function

Callback function for update all

Source:

_UPDATE_ALL(options, cb)

Convenience method for .update with the multi options set to true for multiple document updates

Parameters:
Name Type Description
options Object

Configurable options for loki update with multi true

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

query Object

Query that should be used in update

updatequery Object <optional>

Alias for options.query if options.query is set this option is ignored

updateattributes Object

A loki update formatted object

updatedoc Object <optional>

Object specifying fields to update with new values this object will be formatted as a patch update. If options.updateattributes is set this option is ignored

cb function

Callback function for update all

Source:

_UPDATE_ALL(options, cb)

Convenience method for .update with the multi options set to true for multiple document updates

Parameters:
Name Type Description
options Object

Configurable options for mongo update with multi true

Properties
Name Type Attributes Default Description
model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

query Object

Query that should be used in update

updatequery Object <optional>

Alias for options.query if options.query is set this option is ignored

updateattributes Object

A mongo update formatted object

updatedoc Object <optional>

Object specifying fields to update with new values this object will be formatted as a patch update. If options.updateattributes is set this option is ignored

cb function

Callback function for update all

Source:

_UPDATED(options, cb)

Convenience method for .findAndUpdate lowkie method (returns updated document instead of normal loki update status object)

Parameters:
Name Type Description
options Object

Configurable options for loki update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updated document

id string

The loki _id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The lowkie model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

_UPDATED(options, cb)

Convenience method for .update + .findOne sequelize method (returns updated document instead of normal number updated status)

Parameters:
Name Type Description
options Object

Configurable options for SQL update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updated document

id string

The SQL id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The sequelize model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

_UPDATED(options, cb)

Convenience method for .findAndUpdate mongoose method (returns updated document instead of normal mongo update status object)

Parameters:
Name Type Description
options Object

Configurable options for mongo update

Properties
Name Type Attributes Default Description
isPatch Boolean

If true the update will be treated as a patch instead of a full document update

updatedoc Object

Either specific fields to update in the case of a patch otherwise the entire updated document

id string

The mongo _id of the document that should be updated

skip_xss Boolean <optional>

If true xss character escaping will be skipped and xss whitelist is ignored

html_xss Boolean <optional>

If true xss npm module will be used for character escaping

track_changes Boolean <optional>

If false changes will not be tracked

ensure_changes Boolean <optional>

If true changeset generation and saving is blocking and errors will cause entire operation to fail

model Object <optional>
this.model

The mongoose model for query will default to the this.model value if not defined

cb function

Callback function for update

Source:

defaultError(e) → {Object}

A default on error function for each iteration of cursor

Parameters:
Name Type Description
e Object

An instance of Error

Source:
Returns:

Returns a rejected Promise

Type
Object

defaultSuccess(data) → {*}

A default on success function for each iteration of cursor

Parameters:
Name Type Description
data *

Generally a single document be pushed by stream but can be any data type or a Buffer if cursor is not instantiated in objectMode

Source:
Returns:

Simply returns whatever data is passed as data arugment

Type
*

GENERATE_PATCH(data) → {function}

Creates a lowkie update operation

Parameters:
Name Type Description
data Object

Any fields that should be updated as part of patch

Source:
Returns:

Returns a function that is used in loki update operation

Type
function

GENERATE_PATCH(data) → {Object}

Creates a mongoose update operation that only uses $set and $push

Parameters:
Name Type Description
data Object

Any fields that should be updated as part of patch

Source:
Returns:

Returns an object with $set and $push properties

Type
Object

GENERATE_PUT(data) → {Object}

Returns a cleaned object for a full document update

Parameters:
Name Type Description
data Object

A full document with updated data for put

Source:
Returns:

Returns original object with reserved fields removed

Type
Object

GENERATE_PUT(data) → {Object}

Returns a cleaned object for a full document update

Parameters:
Name Type Description
data Object

A full document with updated data for put

Source:
Returns:

Returns original object with reserved fields removed

Type
Object

GENERATE_SELECT(fields)

Takes a set of fields either as a comma delimited list or a mongoose style fields object and converts them into a sequelize compatible array

Parameters:
Name Type Description
fields Object | string

Fields that should be returned when running the query

Source: