[SERVER-47208] mongod --version is formatted awkwardly Created: 31/Mar/20 Updated: 29/Oct/23 Resolved: 08/May/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Diagnostics |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.0-rc6, 4.7.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Bruce Lucas (Inactive) | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Backport Requested: |
v4.4
|
||||||||||||||||||||
| Sprint: | Service arch 2020-05-18 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||
| Description |
This is a very unusual formatting for a json document. Standard pretty-printed formatting would be something like
|
| Comments |
| Comment by Githook User [ 08/May/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: (cherry picked from commit 5e34f22c838de78290b574519abb7a7241bc1059) |
| Comment by Githook User [ 08/May/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 06/May/20 ] |
| Comment by Bruce Lucas (Inactive) [ 04/May/20 ] |
|
billy.donahue, sounds like there's already code to do this, so should be pretty easy to do? Can we get this in for 4.4.0? I think this will look sloppy to customers. Regarding specifics of formatting, I think, having originated in Javascript, the standard for JSON formatting is set by Javascript's JSON.stringify (in particular the pretty-printing variant, e.g. JSON.stringify(o, null, 4)). This would format it as in my initial comment. Also this is basically the format we've adopted in the mongo shell for JSON pretty-printing. |
| Comment by Billy Donahue [ 09/Apr/20 ] |
|
I wouldn't want to do that just to rearrange some commas. If it comes down to it, I wrote a json pretty printer pretty quickly for the stacktracing project we can use for stuff like this. It produces indentation and commas almost like we'd expect. There was an aesthetic LISP-like choice to join closing braces to the preceding line but we can do whatever.
|
| Comment by Bruce Lucas (Inactive) [ 09/Apr/20 ] |
|
I don't suppose you could just pass it through the Javascript engine as JSON.stringify(o, null, 4)? |
| Comment by Billy Donahue [ 08/Apr/20 ] |
|
Ugh I know. This is what our tojson(BSONObj) function emits in pretty mode. Here it is: |