[SERVER-9606] $cond operator should allow $match as a boolean expression Created: 07/May/13 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Dillon Krug | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | asya, expression, needs-scope | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
When using $cond in projections, it would be useful to have $match as a boolean expression. Use Case:
This would eliminate the need to add other $cond expressions like $in ( |
| Comments |
| Comment by Asya Kamsky [ 22/Apr/19 ] |
|
grisanty.carlos@c-ven.com this ticket exists because there are tests that one can do in a match expression that cannot be expressed in an aggregation expression. $eq is not one of them (in other words equality can be easily done already with $eq). One such missing example are $geo related match expressions, among others.
|
| Comment by Carlos Grisanty [ 17/Apr/19 ] |
|
Is there any difference between $eq and $match? In my case I used the $eq instead of $match. I think the solution you seek is something like this: $cond: [ { $eq: [ tags: "a tag I like" ] }, 100, 0 ] |