[SERVER-32213] allow $split to accept a list of strings to split on Created: 08/Dec/17  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Asya Kamsky Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

Currently $split takes a single 'xxx' string and splits a string wherever this string appears.

It would be nice if it could accept a list of strings to split on. So

input: {s:"abc/xyz=999-123"}
{split:["$s",['/','=','-']]}
output: [ "abc", "xyz", "999", "123" ]



 Comments   
Comment by Asya Kamsky [ 01/Mar/18 ]

Just realized that split takes a string already, not a character.

So it would have to take an array of strings to allow splitting on one of several delimiter strings.

Comment by Charlie Swanson [ 08/Dec/17 ]

Perhaps it could take a regex as well? Like the javascript split?

> "abcaaadeaafg".split(/a+/)
[ "", "bc", "de", "fg" ]

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