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 builtPlanobject A planBuilder object or a built plan defined as a JSON object. optionsRowsOptions Options that control how the plan is executed and the results isn't returned. bindingArgobject 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 builtPlanobject A planBuilder object or a built plan as a JSON object. formatstring <optional>
The format of the returned representation: 'json'|'xml'. The default is 'json'. queryTypestring <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 builtPlanobject A planBuilder object or a built plan as an XML object. schemastring <optional>
The schema of the query. viewstring <optional>
View of the query. queryTypestring <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 builtPlanobject A planBuilder object or a built plan defined as a JSON object. optionsRowsOptions Options that control how the plan is executed and the results returned. bindingArgobject 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 batchViewplanBuilder.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. optionsobject <optional>
Configures the queryAll operation. onCompletionfunction <optional>
A callback that receives a summary of the results. onBatchErrorfunction <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. queryTypestring <optional>
The type of a string query submitted for execution. Possible values: 'json'|'sparql'|'sql'|'dsl'. Default: 'json'. batchSizeInteger <optional>
Controls the number of rows retrieved in each request concurrentRequestsobject <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". columnTypesstring <optional>
Whether to emit column data types on each row or only the column name header. Possible values: 'rows'|'header'. Default: 'rows'. rowStructurestring <optional>
Structure of the output. Possible values:'object'|'array'. Default: 'object'. consistentSnapshotboolean | 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. onInitialTimestampfunction <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. outputStreamTypechunked | 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 builtPlanobject A planBuilder object or a built plan defined as a JSON object. streamTypestring Type of stream. Possible values: 'chunked'| 'object'|'sequence'. Default: 'chunked'. optionsRowsOptions 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 formatstring <optional>
Format of the returned results. Possible values: 'json'|'xml'|'csv'. Default: 'json'. structurestring <optional>
Structure of the output. Possible values: 'object'|'array'. Default: 'object'. columnTypesstring <optional>
Whether to emit column data types on each row or only the column name header. Possible values: 'rows'|'header'. Default: 'rows'. complexValuesstring <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. bindingsobject <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. timestampDatabaseClient.Timestamp <optional>
A Timestamp object for point-in-time operations. queryTypestring <optional>
The type of a string query submitted for execution. Possible values: 'json'|'sparql'|'sql'|'dsl'. Default: 'json'.
-
- Since:
-
- 2.1.1