[DOCS-9311] Update or remove recommended "dollar sign operator escaping" scheme Created: 12/Nov/16  Updated: 14/Nov/16  Resolved: 14/Nov/16

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Billy Tetrud Assignee: Allison Reinheimer Moore
Resolution: Done Votes: 0
Labels: bite-sized
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 7 years, 13 weeks, 2 days ago
Story Points: 0.25

 Description   

The following page recommends an ambiguous and harmful escaping scheme: https://docs.mongodb.com/v3.0/faq/developers/#dollar-sign-operator-escaping . People are recommending this escaping scheme based on the fact that its in your documentation, but its a terrible idea. This escaping scheme will break whenever the suggested unicode characters are actually used in the raw key.

Please either remove this harmful recommendation or update it with a proper unambiguous escaping method. Here's an example that is unambiguous and far more human-readable:

// returns an escaped mongo key
exports.escape = function(key)

{ return key.replace(/~/g, '~~') .replace(/\./g, '~,') .replace(/^\$/g, '~$') }

// returns an unescaped mongo key
exports.unescape = function(escapedKey)

{ return escapedKey.replace(/^~$/g, '$') .replace(/~,/g, '.') .replace(/~~/g, '~') }

 Comments   
Comment by Githook User [ 14/Nov/16 ]

Author:

{u'username': u'schmalliso', u'name': u'Allison Moore', u'email': u'allison.moore@10gen.com'}

Message: DOCS-9311: removes dollar-sign escaping FAQ item
Branch: v3.0
https://github.com/mongodb/docs/commit/3cb0c576256d27266a1ab5475dac715b746c157a

Generated at Thu Feb 08 07:58:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.