[SERVER-29581] Create $_internalSchemaMinLength and $_internalSchemaMaxLength MatchExpressions Created: 12/Jun/17 Updated: 30/Oct/23 Resolved: 14/Jul/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.11 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Kyle Suarez | Assignee: | Natalia Jacobowitz |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Query 2017-07-10, Query 2017-07-31 | ||||||||
| Participants: | |||||||||
| Description |
|
Create a $_internalSchemaMinLength MatchExpression, which takes a positive integer. It matches string fields whose length are at least the specified value:
$_internalSchemaMaxLength works similarly for maximum length.
Then, we can use these expression to emit MatchExpressions for the JSON Schema "minLength" and "maxLength" keywords. |
| Comments |
| Comment by Kyle Suarez [ 01/Aug/17 ] |
|
Cool, I filed |
| Comment by David Storch [ 01/Aug/17 ] |
|
kyle.suarez, I'd say a new ticket given that this work is already in master. |
| Comment by Kyle Suarez [ 01/Aug/17 ] |
|
I agree, based on my reading of RFC 4627 §1:
and JSON Schema Draft 04 §5.2.1.2:
I can file a ticket for this or reopen this one; whatever is your preference. |
| Comment by David Storch [ 01/Aug/17 ] |
|
kyle.suarez, my reading of RFC 4627 is that JSON strings are unicode. Therefore, I think these match expressions should probably count code points rather than bytes in the UTF-8 encoding. Does that match your understanding of the JSON Schema spec? At first glance it wasn't completely clear to me. |
| Comment by Kyle Suarez [ 01/Aug/17 ] |
|
This code was implemented using BSONElement::valuestrlen(), which does a simple counting of the number of bytes in a string. If we need to support multibyte characters, we'll need a slight tweak. |
| Comment by Githook User [ 14/Jul/17 ] |
|
Author: {u'name': u'Natalia Jacobowitz', u'email': u'nataliajacobowitz@MacBook-Pro-107.local'}Message: |