Details
-
Improvement
-
Resolution: Duplicate
-
Trivial - P5
-
None
-
2.2.0
-
None
Description
Pre requisites:
The regex returns a boolean
Should be trivial to make it work as the expression in a $cond while projecting
Example:
Schema:
{
|
'_id': IDObject,
|
'Path': string,
|
'...': a bunch of other fields
|
}
|
Aggregation command:
{
|
'$match': { ... }
|
},
|
{
|
'$project': {
|
'_id': '$_id',
|
'EndsWithString': {
|
'$cond': [
|
{'$Path': {'$regex': 'String$'}}, # This is the same notation that for find or find_one. It should return true/false
|
true,
|
false
|
]
|
}
|
}
|
}
|
PS: I very influenced by the pymongo driver so excuse me if I mix console and python notation. Trying to ilustrate the point
Attachments
Issue Links
- duplicates
-
SERVER-11947 Add a regex expression to the aggregation language
-
- Closed
-
- related to
-
SERVER-8582 Extend document expression language in aggregation to support advanced document filtering.
-
- Closed
-