[SERVER-6203] Aggregation operators should have well defined implicit type coercion behavior. Created: 25/Jun/12 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andy Schwerin | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 11 |
| Labels: | expression, usability | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Some expressions implicitly convert types, but this behavior is not always consistent or clearly documented. |
| Comments |
| Comment by Asya Kamsky [ 09/Mar/18 ] |
|
The attached table shows the current implicit conversion behaviors. Top row are types to which conversions can be implicitly attempted. Example: any type can be used as conditional in $cond if: expression and it gets coerced to boolean type. Multiple string expressions ($substr,{$toUpper}, etc) will attempt to coerce a value to string. All date expressions try to coerce provided date to ISODate type.
Timestamp() BSON type is omitted from this table but it is generally treated same as ISODate() so anywhere date is expected Timestamp will successfully implicitly convert to date. |
| Comment by David Storch [ 06/Mar/18 ] |
|
Explicit type conversion operators in the aggregation expression language have been implemented as the $convert operator under I've narrowed this ticket to be about implicit type coercion behavior in the expression language (rather than about explicit conversion operators). |
| Comment by Raviteja [ 15/Feb/18 ] |
|
Any ETA? |