[SERVER-27144] Number.prototype.zeroPad() returns erroneous output if target width is not greater than stringified number's length Created: 21/Nov/16 Updated: 06/Dec/22 Resolved: 03/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Jonathan Abrahams | Assignee: | Backlog - Server Tooling and Methods (STM) (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | move-stm | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Server Tooling & Methods
|
||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||||||||
| Participants: |
| Description |
|
Padding on a number should pad up to the width specified or return the stringified number if no padding is required. Doing so would match the behavior of String.prototype.padStart().
|
| Comments |
| Comment by Brooke Miller [ 03/Dec/21 ] | ||||
|
We've deprecated the mongo shell in favor of the new mongosh. Unfortunately, we aren't able to pursue improvements to the deprecated shell except in extreme cases, such as critical security fixes. Please start making use of mongosh and let us know if it works for you in this case. | ||||
| Comment by Max Hirschhorn [ 21/Nov/16 ] | ||||
|
I'm moving this ticket over to the the platforms team because it has to deal with the behavior of the mongo shell and I don't think this behavior impacts existing tests that use Number.prototype.zeroPad().
I'm clearing the backport request for v3.4 because this has been the behavior as far back as MongoDB 2.6 and I don't think it necessarily urgent to fix. I've also clarified the title to reflect that an exception isn't being thrown. I suspect that this may simply be an issue with how the mongo shell displays values that are instances of String, and not typeof "string".
|