Skip to content

Commit b571ef1

Browse files
author
Dave
authored
DOCSP-19951 update insert pt5 v5.1 (#98) (#103)
* Add more pages * Add more files * ToDouble output updates * Update toDecimal * Table resize * Feedback comments * Feedback comments
1 parent d08669c commit b571ef1

File tree

10 files changed

+274
-125
lines changed

10 files changed

+274
-125
lines changed

source/reference/operator/aggregation/convert.txt

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ Create a collection ``orders`` with the following documents:
11541154

11551155
.. code-block:: javascript
11561156

1157-
db.orders.insert( [
1157+
db.orders.insertMany( [
11581158
{ _id: 1, item: "apple", qty: 5, price: 10 },
11591159
{ _id: 2, item: "pie", qty: 10, price: NumberDecimal("20.0") },
11601160
{ _id: 3, item: "ice cream", qty: 2, price: "4.99" },
@@ -1201,10 +1201,26 @@ converts the ``price`` to a decimal:
12011201
The operation returns the following documents:
12021202

12031203
.. code-block:: javascript
1204+
:copyable: false
12041205

1205-
{ "_id" : 1, "totalPrice" : NumberDecimal("50.0000000000000") }
1206-
{ "_id" : 2, "totalPrice" : NumberDecimal("200.0") }
1207-
{ "_id" : 3, "totalPrice" : NumberDecimal("9.98") }
1208-
{ "_id" : 4, "totalPrice" : NumberDecimal("0") }
1209-
{ "_id" : 5, "totalPrice" : "NaN" }
1206+
{ _id: 1, totalPrice: Decimal128("50") },
1207+
{ _id: 2, totalPrice: Decimal128("200.0") },
1208+
{ _id: 3, totalPrice: Decimal128("9.98") },
1209+
{ _id: 4, totalPrice: Decimal128("0") },
1210+
{ _id: 5, totalPrice: 'NaN' }
1211+
1212+
.. note::
1213+
1214+
The legacy :binary:`~bin.mongo` shell stores decimals as
1215+
NumberDecimal. In :binary:`~bin.mongo` shell, the operation returns
1216+
the following documents:
1217+
1218+
.. code-block:: javascript
1219+
:copyable: false
1220+
1221+
{ "_id" : 1, "totalPrice" : NumberDecimal("50.0000000000000") }
1222+
{ "_id" : 2, "totalPrice" : NumberDecimal("200.0") }
1223+
{ "_id" : 3, "totalPrice" : NumberDecimal("9.98") }
1224+
{ "_id" : 4, "totalPrice" : NumberDecimal("0") }
1225+
{ "_id" : 5, "totalPrice" : "NaN" }
12101226

0 commit comments

Comments
 (0)