[SERVER-33389] aggregate function similar to regex replace Created: 19/Feb/18 Updated: 21/Mar/18 Resolved: 21/Feb/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Sourav Biswas | Assignee: | Kelsey Schubert |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
can we add a feature like regex replace which will find all occurrences of a regex pattern in a string field, and replace them with something generic. example use case -" replace all telephone numbers in a error message with X so that all of them can be group in a single bucket" as of now i think there is no way of doing it other than handling it in client code.Please correct me if there is something already available that i am not aware of, |
| Comments |
| Comment by Kelsey Schubert [ 21/Feb/18 ] |
|
Hi sourav_biswas@cable.comcast.com, Thanks for the clarification. I believe Kind regards, |
| Comment by Sourav Biswas [ 20/Feb/18 ] |
|
Sample
Use case - when grouping on the field "error" i should get a count of 3 in a single group of "got error for telephone x". So essentially there is will be a $project stage before the $group where we can apply some function like * $regexReplace : ["$error","[0-9]{10}","x"]* |
| Comment by Ramon Fernandez Marina [ 20/Feb/18 ] |
|
Will you please provide a sample usage case with some input and output documents so we can have a clear idea of what exact functionality would help your use case? Thanks, |