[SERVER-34122] Pattern Search Support in $filter & $cond operator Created: 25/Mar/18  Updated: 23/Apr/18  Resolved: 26/Mar/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: Rahul Raj Assignee: Kelsey Schubert
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-11947 Add a regex expression to the aggrega... Closed
Participants:

 Description   

Currently there's no way to use pattern match in $filter or $cond operators. Pattern match is most frequently used filtering/conditional methodologies
It seems quite disappointing that there are restrictions on using conditions while the sole purpose of $filter & $cond are to filtering out result set. Sample query is given below. I'm not putting similar code on $cond since it looks same. It would be nice if we can do something like below:

// Some comments here
{
  $filter: {
     input: "$Restaurants",
     as: "restaurant",
     cond: { "$$restaurant":{$regex: "valley"} }
  }
}



 Comments   
Comment by Kelsey Schubert [ 26/Mar/18 ]

Hi rahulraj,

Thank you for the feature request. We're tracking this improvement in SERVER-11947. Please feel free to vote for it and watch it for updates.

Kind regards,
Kelsey

Comment by Rahul Raj [ 25/Mar/18 ]

/valley/ , /^valley/, /valley$/
Not restricting the context on $regex, consider the above mode of pattern search too.
If this feature is implemented, this will enhance other operators too, like $redact

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