Skip to content

fix(query-parser): use json stringify to return code block COMPASS-10946 - #852

Merged
dudaschar merged 2 commits into
mainfrom
COMPASS-10946
Aug 4, 2026
Merged

fix(query-parser): use json stringify to return code block COMPASS-10946#852
dudaschar merged 2 commits into
mainfrom
COMPASS-10946

Conversation

@dudaschar

@dudaschar dudaschar commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Description

Using JSON.stringify to scape code before returning string, more details on ticket.

Open Questions

Checklist

Copilot AI lite review requested due to automatic review settings August 4, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the query-parser BSON-to-JS stringification logic so Code values are emitted using JSON.stringify, improving escaping/quoting of the embedded code string when rendering a JS-like representation.

Changes:

  • Stringify BSON Code values using JSON.stringify(v.code) and reuse the result for both scoped and unscoped forms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 50 to +55
Code: function (v: Code) {
const code = JSON.stringify(v.code);
if (v.scope) {
return `Code('${v.code}',${JSON.stringify(v.scope)})`;
return `Code(${code},${JSON.stringify(v.scope)})`;
}
return `Code('${v.code}')`;
return `Code(${code})`;
@dudaschar dudaschar changed the title fix: use json stringify to return code block COMPASS-10946 fix(query-parser): use json stringify to return code block COMPASS-10946 Aug 4, 2026
@dudaschar
dudaschar marked this pull request as ready for review August 4, 2026 12:32
@dudaschar
dudaschar merged commit cc198ff into main Aug 4, 2026
30 of 33 checks passed
@dudaschar
dudaschar deleted the COMPASS-10946 branch August 4, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants