[DOCS-13182] Investigate changes in SERVER-44326: Add $replaceAll expression Created: 30/Oct/19  Updated: 30/Oct/23  Resolved: 13/Feb/20

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Andrew Feierabend (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-44326 Add $replaceAll expression Closed
Related
Participants:
Days since reply: 3 years, 51 weeks, 6 days ago
Epic Link: DOCS: 4.4 Server Release Work

 Description   

Description

Downstream Change Summary

Adds a $replaceAll expression

Description of Linked Ticket

The query team has discussed and agreed on the following syntax:

Name $replaceAll

Rejected alternate names: $stringReplace, $substringReplace, $replaceSubstring, $stringReplaceAll

It takes in three expressions that must evaluate to strings: an original string, a string to search for, and a string to insert. This would evaluate to a new string with all occurrences of `find` in `input` replaced by `replacement`. Expressions in each argument would first be evaluated and an error thrown if any input evaluates to a non-string, non-nullish type. Next, if any evaluate to null, the expression evaluates to null.

Because this is a searching algorithm and not a direct string comparison, this computation will not consider the operation's collation. This is consistent with other similar expressions like $indexOfCP and $regexFind. Like these other searching expressions, there will be no unicode normalization. This means that a character like 'é' may not be considered a match if the input string represents it as one unicode character and the 'find' string represents it as two characters: a normal 'e' and a combining diacritical mark.

Syntax:

{ $replaceAll: { input: <Expression>, find: <Expression>, replacement: <Expression> } }

Rejected syntax:

{ $replace: [ <Expression | input>, <Expression | find>, <Expression | replace> ] }

For now we will only support strings as all arguments, we will error on other types.

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Githook User [ 13/Feb/20 ]

Author:

{'name': 'Andrew Feierabend', 'username': 'andf-mongodb', 'email': 'andrew.feierabend@mongodb.com'}

Message: DOCS-13182 add replaceAll expression
Branch: master
https://github.com/mongodb/docs/commit/fc127d5b450b0aad44c2c0a260f38a3509da9208

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