Class: Query

Query

(protected) new Query(conn, config, locatoropt)

Query
Parameters:
Name Type Attributes Description
conn Connection Connection object
config Object | String Query config object or SOQL string
locator String <optional>
Locator string to fetch next record set
Implements:
Source:

Extends

  • stream.Readable

Classes

SubQuery

Members

addListener

Source:

filter

Get record stream of queried records, applying the given filter function
Source:

map

Get record stream of queried records applying the given mapping function
Source:

stream

Create data stream of queried records. Automatically resume query if paused.
Source:

Methods

autoFetch(autoFetch) → {Query.<T>}

Switching auto fetch mode
Parameters:
Name Type Description
autoFetch Boolean Using auto fetch mode or not
Source:
Returns:
Type
Query.<T>

del(typeopt, callbackopt) → {Bulk~Batch}

Synonym of Query#destroy()
Parameters:
Name Type Attributes Description
type String <optional>
SObject type. Required for SOQL based query object.
callback Callback.<Array.<RecordResult>> <optional>
Callback function
Source:
Returns:
Type
Bulk~Batch

delete(typeopt, callbackopt) → {Bulk~Batch}

Synonym of Query#destroy()
Parameters:
Name Type Attributes Description
type String <optional>
SObject type. Required for SOQL based query object.
callback Callback.<Array.<RecordResult>> <optional>
Callback function
Source:
Returns:
Type
Bulk~Batch

destroy(typeopt, callbackopt) → {Promise.<Array.<RecordResult>>}

Bulk delete queried records
Parameters:
Name Type Attributes Description
type String <optional>
SObject type. Required for SOQL based query object.
callback Callback.<Array.<RecordResult>> <optional>
Callback function
Source:
Returns:
Type
Promise.<Array.<RecordResult>>

exec(optionsopt, callbackopt) → {Query.<T>}

Synonym of Query#execute()
Parameters:
Name Type Attributes Description
options Object <optional>
Query options
Properties
Name Type Attributes Description
autoFetch Boolean <optional>
Using auto fetch mode or not
maxFetch Number <optional>
Max fetching records in auto fetch mode
scanAll Boolean <optional>
Including deleted records for query target or not
callback Callback.<T> <optional>
Callback function
Source:
Returns:
Type
Query.<T>

execute(optionsopt, callbackopt) → {Query.<T>}

Execute query and fetch records from server.
Parameters:
Name Type Attributes Description
options Object <optional>
Query options
Properties
Name Type Attributes Description
autoFetch Boolean <optional>
Using auto fetch mode or not
maxFetch Number <optional>
Max fetching records in auto fetch mode
scanAll Boolean <optional>
Including deleted records for query target or not
callback Callback.<T> <optional>
Callback function
Source:
Returns:
Type
Query.<T>

explain(callbackopt) → {Promise.<ExplainInfo>}

Explain plan for executing query
Parameters:
Name Type Attributes Description
callback Callback.<ExplainInfo> <optional>
Callback function
Source:
Returns:
Type
Promise.<ExplainInfo>

include(childRelName, conditionsopt, fieldsopt, optionsopt) → {Query~SubQuery}

Include child relationship query
Parameters:
Name Type Attributes Description
childRelName String Child relationship name to include in query result
conditions Object | String <optional>
Conditions in JSON object (MongoDB-like), or raw SOQL WHERE clause string.
fields Object | Array.<String> | String <optional>
Fields to fetch. Format can be in JSON object (MongoDB-like), array of field names, or comma-separated field names.
options Object <optional>
Query options.
Properties
Name Type Attributes Description
limit Number <optional>
Maximum number of records the query will return.
offset Number <optional>
Offset number where begins returning results.
skip Number <optional>
Synonym of options.offset.
Source:
Returns:
Type
Query~SubQuery

limit(limit) → {Query.<T>}

Limit the returning result
Parameters:
Name Type Description
limit Number Maximum number of records the query will return.
Source:
Returns:
Type
Query.<T>

maxFetch(maxFetch) → {Query.<T>}

Setting maxFetch query option
Parameters:
Name Type Description
maxFetch Number Max fetching records in auto fetch mode
Source:
Returns:
Type
Query.<T>

offset(offset) → {Query.<T>}

Synonym of Query#skip()
Parameters:
Name Type Description
offset Number Offset number where begins returning results.
Source:
Returns:
Type
Query.<T>

offset(offset) → {Query.<T>}

Skip records
Parameters:
Name Type Description
offset Number Offset number where begins returning results.
Source:
Returns:
Type
Query.<T>

on()

Source:

run(optionsopt, callbackopt) → {Query.<T>}

Synonym of Query#execute()
Parameters:
Name Type Attributes Description
options Object <optional>
Query options
Properties
Name Type Attributes Description
autoFetch Boolean <optional>
Using auto fetch mode or not
maxFetch Number <optional>
Max fetching records in auto fetch mode
scanAll Boolean <optional>
Including deleted records for query target or not
callback Callback.<T> <optional>
Callback function
Source:
Returns:
Type
Query.<T>

scanAll(scanAll) → {Query.<T>}

Set flag to scan all records including deleted and archived.
Parameters:
Name Type Description
scanAll Boolean Flag whether include deleted/archived record or not. Default is false.
Source:
Returns:
Type
Query.<T>

select(fields) → {Query.<T>}

Select fields to include in the returning result
Parameters:
Name Type Description
fields Object | Array.<String> | String Fields to fetch. Format can be in JSON object (MongoDB-like), array of field names, or comma-separated field names.
Source:
Returns:
Type
Query.<T>

(protected) setResponseTarget(responseTarget) → {Query.<S>}

Parameters:
Name Type Description
responseTarget String Query response target
Source:
Returns:
Type
Query.<S>

sort(sort, diropt) → {Query.<T>}

Set query sort with direction
Parameters:
Name Type Attributes Description
sort String | Object Sorting field or hash object with field name and sord direction
dir String | Number <optional>
Sorting direction (ASC|DESC|1|-1)
Source:
Returns:
Type
Query.<T>

then(onFulfilledopt, onRejectedopt) → {Promise.<(S1|S2)>}

Promise/A+ interface http://promises-aplus.github.io/promises-spec/ Delegate to deferred promise, return promise instance for query result
Parameters:
Name Type Attributes Description
onFulfilled FulfilledCallback.<T, S1> <optional>
onRejected RejectedCallback.<S2> <optional>
Source:
Returns:
Type
Promise.<(S1|S2)>

thenCall(callbackopt) → {Query}

Promise/A+ extension Call "then" using given node-style callback function
Parameters:
Name Type Attributes Description
callback Callback.<T> <optional>
Callback function
Source:
Returns:
Type
Query

toSOQL(callbackopt) → {Promise.<String>}

Return SOQL expression for the query
Parameters:
Name Type Attributes Description
callback Callback.<String> <optional>
Callback function
Source:
Returns:
Type
Promise.<String>

update(mapping, typeopt, callbackopt) → {Promise.<Array.<RecordResult>>}

Bulk update queried records, using given mapping function/object
Parameters:
Name Type Attributes Description
mapping Record | RecordMapFunction Mapping record or record mapping function
type String <optional>
SObject type. Required for SOQL based query object.
callback Callback.<Array.<RecordResult>> <optional>
Callback function
Source:
Returns:
Type
Promise.<Array.<RecordResult>>

where(conditions) → {Query.<T>}

Set query conditions to filter the result records
Parameters:
Name Type Description
conditions Object | String Conditions in JSON object (MongoDB-like), or raw SOQL WHERE clause string.
Source:
Returns:
Type
Query.<T>