diff --git a/node.js/cds-ql.md b/node.js/cds-ql.md index 3c1795611..51eb0b8c0 100644 --- a/node.js/cds-ql.md +++ b/node.js/cds-ql.md @@ -704,30 +704,37 @@ If a queried record is already exclusively locked by another transaction, the `. Passes hints to the database query optimizer that can influence the execution plan. The hints can be passed as individual arguments or as an array. - ```js SELECT ... .hints ('IGNORE_PLAN_CACHE') SELECT ... .hints ('IGNORE_PLAN_CACHE', 'MAX_CONCURRENCY(1)') SELECT ... .hints (['IGNORE_PLAN_CACHE', 'MAX_CONCURRENCY(1)']) ``` -### pipeline() {.method} -Returns the data from the database as a raw stream. +### pipeline() {.method} +Pipes the data from the database into the given writable stream. ```js -SELECT ... .pipeline () SELECT ... .pipeline (cds.context.http.res) ``` > Please note that the after handlers don't have effect if this stream is piped to the HTTP response. + +### stream() {.method} + +Returns the data from the database as a raw stream. + +```js +SELECT ... .stream () +``` + + ### foreach() {.method} Creates an object stream and calls the provided callback for each object. - ```js await SELECT.from(Books).foreach ((book) => { ... }) ``` @@ -742,6 +749,8 @@ for await (const book of SELECT.from(Books)) { ... } As of now, `SELECT.foreach()` and `SELECT.pipeline()` are only supported by `cds.DatabaseService`. `cds.RemoteService` does not support the streaming APIs yet. ::: + + ## INSERT {.class} Fluent API to construct [CQN INSERT](../cds/cqn#insert) query objects in a [CQL](../cds/cql)/SQL-like style. In contrast to SQL, though, the clauses can be arrayed in arbitrary order.