Namespace: rows

rows

Provides functions for performing SQL-like, relational operations on MarkLogic data. Enables you to retrieve document data as rows by executing a plan constructed by a planBuilder.

Methods


execute(builtPlan, options, bindingArg)

Executes a plan built by a planBuilder and returns a promise data structure.
Parameters:
Name Type Description
builtPlan object A planBuilder object or a built plan defined as a JSON object.
options RowsOptions Options that control how the plan is executed and the results isn't returned.
bindingArg object Data object for dynamic parameter binding.
Since:
  • 3.1.0

explain(builtPlan, format, queryType) → {Promise}

Returns an explanation of an execution plan as a promise.
Parameters:
Name Type Argument Description
builtPlan object A planBuilder object or a built plan as a JSON object.
format string <optional>
The format of the returned representation: 'json'|'xml'. The default is 'json'.
queryType string <optional>
The type of a string query submitted for explanation. Possible values: 'json'|'sparql'|'sql'|'dsl'. Default: 'json'.
Since:
  • 2.1.1
Returns:
A promise whose success callback receives the explanation as JSON or XML.
Type
Promise

generateView(builtPlan, schema, view, queryType) → {Promise}

Generates the view of an execution plan as a promise.
Parameters:
Name Type Argument Description
builtPlan object A planBuilder object or a built plan as an XML object.
schema string <optional>
The schema of the query.
view string <optional>
View of the query.
queryType string <optional>
The type of a string query submitted for execution.
Since:
  • 2.7.0
Returns:
A promise whose success callback receives the explanation as an XML.
Type
Promise

query(builtPlan, options, bindingArg) → {Promise}

Executes a plan built by a planBuilder and returns a promise data structure.
Parameters:
Name Type Description
builtPlan object A planBuilder object or a built plan defined as a JSON object.
options RowsOptions Options that control how the plan is executed and the results returned.
bindingArg object Data object for dynamic parameter binding.
Since:
  • 2.1.1
Returns:
A Promise.
Type
Promise

queryAll(batchView, options, onCompletion, onBatchError, queryType, batchSize, concurrentRequests, columnTypes, rowStructure, consistentSnapshot, onInitialTimestamp, outputStreamType) → {stream.Readable}

The queryAll function, equivalent to the DMSDK RowBatcher, reads one or more row(s). The optional options include onCompletion, batchSize, onBatchError, queryType, concurrentRequests, columnTypes, rowStructure, rowFormat, onInitialTimestamp, outputStreamType and consistentSnapshot.
Parameters:
Name Type Argument Description
batchView planBuilder.ModifyPlan | object | string A query that exports a modified subset of rows from a view expressed as a modify plan without parameters built by the PlanBuilder, a JavaScript literal object equivalent to a JSON AST representation of the modify plan or a string literal with the JSON AST or Query DSL representation of the modify plan.
options object <optional>
Configures the queryAll operation.
onCompletion function <optional>
A callback that receives a summary of the results.
onBatchError function <optional>
A callback that responds to any error while reading a batch of documents. Takes progressSoFar and the error as parameters and controls the resolution by returning true, false or an error.
queryType string <optional>
The type of a string query submitted for execution. Possible values: 'json'|'sparql'|'sql'|'dsl'. Default: 'json'.
batchSize Integer <optional>
Controls the number of rows retrieved in each request
concurrentRequests object <optional>
JavaScript object literal that controls the maximum number of concurrent requests that can be pending at the same time. Valid keys are "multipleOf" and "multiplier".
columnTypes string <optional>
Whether to emit column data types on each row or only the column name header. Possible values: 'rows'|'header'. Default: 'rows'.
rowStructure string <optional>
Structure of the output. Possible values:'object'|'array'. Default: 'object'.
consistentSnapshot boolean | DatabaseClient.timestamp <optional>
Controls whether to get an immutable view of the result set. Each request gets the latest data at the time of the request if not set/ false. Uses the timestamp of the first request for all subsequent requests if true. Uses the supplied timestamp for all requests if set to DatabaseClient.timestamp object.
onInitialTimestamp function <optional>
Receives the timestamp from the first request. Takes parameters of - Timestamp object for the server timestamp for the result set. Throws error if consistentSnapshot is not true.
outputStreamType chunked | object | sequence <optional>
Controls whether data is written to the output stream as chunks or object.
Since:
  • 3.0.0
Returns:
- a stream.Readable that sends rows read from the database to the application in the configured mode.
Type
stream.Readable

queryAsStream(builtPlan, streamType, options) → {ReadableStream}

Executes a plan built by a planBuilder and returns a readable stream data structure.
Parameters:
Name Type Description
builtPlan object A planBuilder object or a built plan defined as a JSON object.
streamType string Type of stream. Possible values: 'chunked'| 'object'|'sequence'. Default: 'chunked'.
options RowsOptions Options that control how the plan is executed and the results returned.
Since:
  • 2.1.1
Returns:
A readable stream.
Type
ReadableStream

Type Definitions


RowsOptions

Specifies how a planBuilder plan is executed, the formatting of the results returned, and variable bindings.
Type:
  • object
Properties:
Name Type Argument Description
format string <optional>
Format of the returned results. Possible values: 'json'|'xml'|'csv'. Default: 'json'.
structure string <optional>
Structure of the output. Possible values: 'object'|'array'. Default: 'object'.
columnTypes string <optional>
Whether to emit column data types on each row or only the column name header. Possible values: 'rows'|'header'. Default: 'rows'.
complexValues string <optional>
Whether complex array, binary, element, object, and text node columns should be serialized inline or as a reference to a separate response part. Possible values: 'inline'|'reference'. Default: 'inline'. Only relevant when results are delivered as an JSON object stream.
bindings object <optional>
Values for placeholder variables within the query plan. You define them with an object whose keys are the names of the variables and whose values are either primitives or objects with a type or lang key and a value key. Bindings are handled the same way as with graphs#sparql and graphs#sparqlUpdate.
timestamp DatabaseClient.Timestamp <optional>
A Timestamp object for point-in-time operations.
queryType string <optional>
The type of a string query submitted for execution. Possible values: 'json'|'sparql'|'sql'|'dsl'. Default: 'json'.
Since:
  • 2.1.1
Copyright (c) 2020 MarkLogic Corporation Documentation generated by JSDoc 4.0.0 on 2024-08-20T21:35:27-07:00 using the DocStrap template.