File tree Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -60,17 +60,34 @@ Starting in 1.8.0, the ``ObjectId`` wrapper no longer accepts:
6060
6161 :method:`ObjectId`
6262
63+ Double
64+ ------
65+
66+ The :node-api:`Double() <Double.html>` constructor can be used to
67+ explicitly specify a double:
68+
69+ .. code-block:: javascript
70+
71+ db.types.insertOne(
72+ {
73+ "_id": 2,
74+ "value": Double(1),
75+ "expectedType": "Double"
76+ }
77+ )
78+
79+ .. note::
80+
81+ If field's value is a number that can be converted to a 32-bit integer,
82+ ``mongosh`` will store it as ``Int32``. If not, ``mongosh`` defaults to
83+ storing the number as a ``Double``. To specify the value type, use the
84+ ``Double()`` or ``Int32()`` constructors.
85+
6386.. _shell-type-int:
6487
6588Int32
6689-----
6790
68- If a number can be converted to a 32-bit integer, ``mongosh`` will
69- store it as ``Int32``. If not, ``mongosh`` defaults to storing the
70- number as a ``Double``. Numerical values that are stored as ``Int32``
71- in ``mongosh`` would have been stored by default as ``Double`` in the
72- ``mongo`` shell.
73-
7491The :node-api:`Int32() <Int32.html>` constructor can be used to
7592explicitly specify 32-bit integers.
7693
@@ -79,7 +96,7 @@ explicitly specify 32-bit integers.
7996 db.types.insertOne(
8097 {
8198 "_id": 1,
82- "value": Int32("1" ),
99+ "value": Int32(1 ),
83100 "expectedType": "Int32"
84101 }
85102 )
@@ -103,7 +120,7 @@ explicitly specify a 64-bit integer.
103120 db.types.insertOne(
104121 {
105122 "_id": 3,
106- "value": Long("1" ),
123+ "value": Long(1 ),
107124 "expectedType": "Long"
108125 }
109126 )
You can’t perform that action at this time.
0 commit comments