Original Bug Report
1. Try to insert the doc with double backslash in one of the values, for example
{User: "DOMAIN\\someuser"}2. Try to query for value containing two backslashes
Task on this ticket
- Document (e.g. in Jira ticket / Google Doc) the behavior for all Compass string input fields
- Explain background in a few paragraphs: How does escaping work in Javascript / JSON, how does MongoDB store the string in BSON?
Freetext String Input Fields
Document current behavior of "Insert Document" input handling of special character sequences, including
- single backslash
- double backslash
- double-quote
- newline (backslash followed by n)
See e.g. Single Character Escape Sequences in JavaScript.
Document what was inserted, how it is stored in MongoDB (e.g. inspection via mongo shell or mongoexport) and how it is displayed in Compass.
Fields to check:
- Insert Document: key names
- Insert Document: string values
- Create Database names
- Create Collection names
- Query Bar inputs (filter keys and values, project/sort keys only)
- Create Index: key names
- Document Validation: key names and string values (regex, ranges, equal/not equal, json view)
- Delete Database / Collection confirmation dialog
- Connect dialog fields
For example, for Query Bar:
Document current behavior of "Query Bar" input handling of special character sequences, including the same as above. What was typed, what query was sent to the server (see e.g. mongo logs with db.setLogLevel(1)) and what documents from above were matched with the query.
Future Work
Based on the outcome of the reproduction and documentation of current behavior, we can make a decision on what the desired behavior should be and create appropriate tickets to implement this.
For example:
- Create COMPASS task ticket to add info sprinkles to explain to user
- Create DOCS ticket to turn this report into a user-facing documentation
- Create tickets to resolve inconsistencies between query bar / crud / doc validation / ...
Further Resources and Tools
- related to
-
SERVER-20451 Backslashes disappear in the shell
- Closed
-
COMPASS-1014 Unable to Enter Line Breaks in Strings
- Closed
- links to