-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.1
-
Component/s: Shell
-
None
-
ALL
-
When using the mongo shell, copying a query result into an insert will not yield the same document. In particular, types can change: integer fields will be casted to doubles. To put it simply, if you copy-paste A to B, A ! = B. Yikes!
This was a big surprise to me, and contrasts with other types like object ids and timestamps, which are printed with their wrapping functions. Offhand, I see two options for fixing this:
Option 1: If the shell has a default type interpretation (doubles), non-doubles should be printed in query results wrapped in their function (`NumberInt`). This is consistent with the other aforementioned types, and would make copy-paste work correctly.
Option 2: Queries in the shell could interpret integers as integers, rather than casting everything to a double. I like this option less, as it's a breaking change to shell behavior and could lead to similarly unintuitive behavior for other use cases.
- duplicates
-
MONGOSH-1032 NumberInt object wrapper is not displayed
- Closed