[SERVER-9156] Projection by a substring match Created: 28/Mar/13  Updated: 06/Dec/22  Resolved: 23/Jun/17

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

Type: New Feature Priority: Major - P3
Reporter: BreakPhreak Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 5
Labels: expression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-8951 Add $findChar or $indexOf operator fo... Closed
is related to SERVER-11947 Add a regex expression to the aggrega... Closed
Assigned Teams:
Query
Participants:

 Description   

Let's start from an example: suppose that each document in a collection contains a UserAgent string as a field. Androids have something like "xxxxxx Android xxxx", iOS have something like "xxxxxxx iPad/iPhone xxxxxx".

I would like to count those documents, grouped by platform (Android, iPad, iPhone). To get the platform, all I need is to count them by a substring match. For example, /Android/ vs /iPad/ vs /iPhone/ (each counted separately).

Any solution with aggregation framework will make it for me. I can clarify/whirpool on any request with pleasure.



 Comments   
Comment by Charlie Swanson [ 23/Jun/17 ]

This is now possible with $indexOf* expressions (SERVER-8951). A more general regex operator is also proposed in SERVER-11947, so I'm closing this ticket.

Please re-open if this use-case is not covered by either of those.

Comment by Asya Kamsky [ 03/Jan/17 ]

This is already possible now with $indexOf* (SERVER-8951) expressions, we can leave this ticket open to tracking adding simpler syntax for "substringOf" type of query, or we can close it as duplicate.

Comment by Asya Kamsky [ 31/May/15 ]

SERVER-8951 somewhat related as it's asking for "index of" operator which would allow using $substr in combination with "index of"/find in string to do what this ticket is asking for (though less elegantly).

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