[SERVER-793] mongo shell: display "floatApprox" only when approximating bson int/long Created: 19/Mar/10  Updated: 22/Mar/10  Resolved: 22/Mar/10

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 1.3.4
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: rphlx Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Unlike 1.2.x, 1.3.4's shell displays

{ "floatApprox" } on every bson_long/bson_int field, even when the displayed value is exact. This makes the output larger and harder to read. Change such that { "floatApprox" }

is only displayed when the double representation is actually inexact.

IRC:
<rphlx> what's up with the floatApprox stuff in the 1.3.x shell? i.e. 1.2.3 had "user_id" : 1; 1.3x has "user_id" :

{ "floatApprox" : 1 }

. user_id is a bson_long..
<mdirolf> rphlx: JS has no real way of representing a long
<mdirolf> everything is a "Number" (double precision floating point) in JS
<rphlx> fine, but i am using ints less than 53 bits, that fit in a double mantissa. there's no approximation, they're exact
<mdirolf> rphlx: yeah when things fit in mantissa i would vote for just representing directly
<rphlx> eh, is there a way to turn off the "floatApprox" display? i don't need to be reminded of js limitations on every field
<mdirolf> rphlx: don't think so - but maybe open a case in jira to only use it when necessary like you suggest



 Comments   
Comment by Eliot Horowitz (Inactive) [ 22/Mar/10 ]

we can't do this as it will change the type of values.

1) insert long
2) touch in shell
3) now have double or int
4) in code assume its a long
5) break

well try and make working with these in the shell nicer
you can .toNumber() now

Generated at Thu Feb 08 02:55:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.