[SERVER-12890] Validate values in query projection Created: 25/Feb/14 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.6.0-rc0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | 26qa | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query Optimization
|
||||
| Participants: | |||||
| Description |
|
When using query projection, only 1/0 and true/false are valid for the values (plus null and undefined maybe):
Other values should be disallowed, for example:
Especially for text search, $meta: "textScore" can be very confusing. |
| Comments |
| Comment by David Percy [ 29/Jan/21 ] |
|
This behavior has changed now that we allow expressions: .find({}, {foo: "bar"}) treats "bar" as a constant expression, not a "yes, include this field" flag. But there are still some confusing cases: .find({}, {foo: 5}) treats 5 as a flag, not an expression. Is it still worth banning some of these cases, or is that too big a language change? |
| Comment by J Rassi [ 25/Feb/14 ] |
|
Suggest that CanonicalQuery validates projection values similarly to sort. Current allow list for sort: -1, 1, {$meta: "textScore"} |