Skip to content

Commit

Permalink
RavenDB-16050 Exporting query result to JSON - updating node.js client
Browse files Browse the repository at this point in the history
  • Loading branch information
ml054 committed Jun 19, 2024
1 parent 5122ac7 commit c853126
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Documents/Commands/QueryStreamCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export class QueryStreamCommand extends RavenCommand<StreamResultResponse> {
}

public createRequest(node: ServerNode): HttpRequestParameters {
const format = this._conventions.useJsonlStreaming ? 'jsonl' : 'json';
const format = this._conventions.useJsonlStreaming ? 'format=jsonl' : "";

return {
method: "POST",
uri: `${node.url}/databases/${node.database}/streams/queries?format=${format}`,
uri: `${node.url}/databases/${node.database}/streams/queries?${format}`,
body: writeIndexQuery(this._conventions, this._indexQuery),
headers: this._headers().typeAppJson().build()
};
Expand Down
7 changes: 5 additions & 2 deletions src/Documents/Session/Operations/StreamOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ export class StreamOperation {
}

private _createRequestForIdPrefix(idPrefix: string, opts: StartingWithOptions): StreamCommand {
const format = this._session.conventions.useJsonlStreaming ? 'jsonl' : 'json';
const sb = new StringBuilder(`streams/docs?`);

if (this._session.conventions.useJsonlStreaming) {
sb.append("format=jsonl&");
}

const sb = new StringBuilder(`streams/docs?format=${format}&`);
if (idPrefix) {
sb.append("startsWith=")
.append(encodeURIComponent(idPrefix)).append("&");
Expand Down

0 comments on commit c853126

Please sign in to comment.