Class: FetchDBO

x2node-dbos~ FetchDBO

Fetch database operation implementation (SQL SELECT query).

new FetchDBO(dbDriver, recordTypes, recordTypeName [, selectedPropPatterns] [, selectedSuperProps] [, filterSpec] [, orderSpec] [, rangeSpec] [, lockType])

Note: The constructor is not accessible from the client code. Instances are created using DBOFactory.
Name Type Argument Description
dbDriver module:x2node-dbos.DBDriver The database driver.
recordTypes module:x2node-records~RecordTypesLibrary Record types library.
recordTypeName string Fetched record type name.
selectedPropPatterns Iterable.<string> <optional>
Selected record property patterns, or nothing if records should not be fetched.
selectedSuperProps Array.<string> <optional>
Selected super-property names, or nothing if no super-properties need to be fetched.
filterSpec Array.<Array> <optional>
Optional specification of the filter to apply to the selected records.
orderSpec Array.<string> <optional>
Optional order specification to apply to the selected records.
rangeSpec Array.<number> <optional>
Optional range specification to apply to the selected records.
lockType string <optional>
Lock type. Either "shared" or "exclusive".



<readonly> complexity :number

Number that characterizes the DBO complexity. A complex DBO involves multiple database queries (2 or more), a single query with joins and/or subqueries (1 or more), super-aggregates queries (2 or more).
  • number

<readonly> involvedRecordTypeNames :Set.<string>

Names of all record types involved in the DBO.
  • Set.<string>


execute(txOrCon, actor [, filterParams])

Execute the operation.
Name Type Argument Description
txOrCon module:x2node-dbos~Transaction | * The active database transaction, or database connection object compatible with the database driver to have the method automatically organize the transaction around the operation execution.
actor module:x2node-common.Actor <nullable>
Actor executing the DBO.
filterParams Object.<string, *> <optional>
Filter parameters. The keys are parameter names, the values are parameter values. Note, that no value type conversion is performed: strings are used as SQL strings, numbers as SQL numbers, etc. Arrays are expanded into comma-separated lists of element values. Functions are called without arguments and the results are used as values. Otherwise, values can be strings, numbers, Booleans and nulls.
If provided filter parameters object is invalid (missing parameter, NaN value or value of unsupported type).
The fetch result promise.

Type Definitions


Fetch DBO execution result object. In addition to the basic result properties will include a property for each requested super-aggregate.
  • Object
Name Type Argument Description
recordTypeName string Fetched record type name.
records Array.<Object> Fetched records, or empty array if none matched.
referredRecords Object.<string, Object> <optional>
Fetched referred records by reference.