[SERVER-56674] Standardize query language to avoid $-prefixes for operator arguments Created: 05/May/21 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Query Language |
| Affects Version/s: | 4.4.4 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Trivial - P5 |
| Reporter: | Al Fatih | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
In some of our oldest query operators, the arguments to the operators start with dollar symbols ($). For example:
or
In most (hopefully all) new language additions, we use a dollar ($) prefix for the operator name, but we do not use a dollar for the arguments to the operator. For example:
For the sake of consistency, we should allow the arguments to be provided without the dollar in all the old/existing places. To preserve backwards compatibility we would still support the $-prefix options, but we could deprecate those and encourage migration to the new format. I hope there are no cases where the grammar would become ambiguous with such a change, but it is worth noting. Original Title: Inconsistency query formatOriginal Description1. The use of $ symbolin $text operator, MongoDB use $ sign as a prefix for each options. But, why MongoDB doesn't use $ sign for a prefix of $function operator options? $text
$function
as seen, body, args and lang options does not use $ sign in their prefix. to improve consistency, $ sign should be used for these options ($body, $args and $lang). 2. The use of $options operatorWhy only $regex operator use that option? Why are the two not combined into one like:
|
| Comments |
| Comment by Al Fatih [ 04/Sep/21 ] |
|
To prevent the Breaking Changes, MongoDB can't remove the dollar sign from the operator. I see. Thanks. |
| Comment by Charlie Swanson [ 11/May/21 ] |
|
Hi lamualfa@gmail.com - I have retitled this ticket to put in what I think is the only way out of this mess. Let me know if it makes sense and if you agree with the new description. |