Class: SubQuery

Query~ SubQuery

<protected> new SubQuery(conn, parent, config)

SubQuery object for representing child relationship query
Parameters:
Name Type Description
conn Connection Connection object
parent Query Parent query object
config Object Sub query configuration
Source:

Extends

Methods

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

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

close()

Closing query. No operation for query is allowed after closing.
Inherited From:
Source:

del(type, callback) → {Bulk~Batch}

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

delete(type, callback) → {Bulk~Batch}

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

destroy(type, callback) → {Bulk~Batch}

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

destroySoon()

Destroy record stream after all record submission in the queue;
Inherited From:
Source:

end() → {Query}

Back the context to parent query object
Source:
Returns:
Type
Query

exec(options, callback) → {Query.<T>}

Synonym of Query#execute()
Parameters:
Name Type Argument Description
options Object <optional>
Query options
Properties
Name Type Argument Description
autoFetch Boolean <optional>
Using auto fetch mode or not
maxFetch Number <optional>
Max fetching records in auto fetch mode
callback Callback.<T> <optional>
Callback function
Inherited From:
Source:
Returns:
Type
Query.<T>

execute()

If execute is called in subquery context, delegate it to parent query object
Source:

filter(fn) → {RecordStream}

Filtering incoming record from upstream, and pass to downstream
Parameters:
Name Type Description
fn RecordFilterFunction Record filtering function
Inherited From:
Source:
Returns:
Type
RecordStream

include()

Source:

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

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

map(fn) → {RecordStream}

Mapping incoming record from upstream, and pass to downstream
Parameters:
Name Type Description
fn RecordMapFunction Record mapping function
Inherited From:
Source:
Returns:
Type
RecordStream

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

Setting maxFetch query option
Parameters:
Name Type Description
maxFetch Number Max fetching records in auto fetch mode
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Query.<T>

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

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

pause()

Pause record fetch
Inherited From:
Source:

pipe()

Auto start query when pipe() is called.
Inherited From:
Source:

resume()

Resume record fetch and query execution
Inherited From:
Source:

run(options, callback) → {Query.<T>}

Synonym of Query#execute()
Parameters:
Name Type Argument Description
options Object <optional>
Query options
Properties
Name Type Argument Description
autoFetch Boolean <optional>
Using auto fetch mode or not
maxFetch Number <optional>
Max fetching records in auto fetch mode
callback Callback.<T> <optional>
Callback function
Inherited From:
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.
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Query.<T>

send(record)

Output record into stream.
Parameters:
Name Type Description
record Record Record object
Inherited From:
Source:

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

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

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

Set query sort with direction
Parameters:
Name Type Argument 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)
Inherited From:
Source:
Returns:
Type
Query.<T>

stream() → {stream.Stream}

Create Node.js stream instance for serializing/deserialize records
Inherited From:
Source:
Returns:
Type
stream.Stream

then(onFulfilled, onRejected) → {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 Argument Description
onFulfilled FulfilledCallback.<T, S1> <optional>
onRejected RejectedCallback.<S2> <optional>
Inherited From:
Source:
Returns:
Type
Promise.<(S1|S2)>

thenCall(callback) → {Promise.<T>}

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

update(mapping, type, callback) → {Bulk~Batch}

Bulk update queried records, using given mapping function/object
Parameters:
Name Type Argument 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
Inherited From:
Source:
Returns:
Type
Bulk~Batch

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.
Inherited From:
Source:
Returns:
Type
Query.<T>