[SERVER-51854] db.serverStatus () the value obtained is of type numberlong Created: 28/Oct/20 Updated: 28/Oct/20 Resolved: 28/Oct/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | zhenchuan ding | Assignee: | Edwin Zhou |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
db.serverStatus () the value obtained is of type numberlong I want to use it db.serverStatus () monitor the status of Mongo, the following commands I executed and the return value >mongo --port 27001 --eval "db.serverStatus().opcounters.command"
How to change the type of numberlong to get more intuitive data
|
| Comments |
| Comment by Edwin Zhou [ 28/Oct/20 ] | ||
|
The mongo shell treats all numbers as floating-point values by default. The mongo shell provides the NumberLong() wrapper to handle 64-bit integers. I'm unsure of what you mean by "intuitive data." If you mean that you desire the stdout be the number inside of NumberLong(), then you can pipe the stdout to select the last line, and trim the rest:
The SERVER project is for bugs and feature suggestions for the MongoDB server. For issues like this, we'd like to encourage you to start by asking our community for help by posting on the MongoDB Developer Community Forums.
Best, Edwin |