6464 - Behavior
6565
6666 * - Boolean
67- - | Returns NumberLong (0) for ``false``.
68- | Returns NumberLong (1) for ``true``.
67+ - | Returns Long (0) for ``false``.
68+ | Returns Long (1) for ``true``.
6969
7070
7171 * - Double
@@ -114,34 +114,34 @@ The following table lists some conversion to long examples:
114114
115115.. list-table::
116116 :header-rows: 1
117- :widths: 80 20
117+ :widths: 67 33
118118
119119 * - Example
120120 - Results
121121
122122 * - ``{ $toLong: true }``
123- - NumberLong ("1")
123+ - Long ("1")
124124
125125 * - ``{ $toLong: false }``
126- - NumberLong ("0")
126+ - Long ("0")
127127
128128 * - ``{ $toLong: 1.99999 }``
129- - NumberLong ("1")
129+ - Long ("1")
130130
131131 * - ``{ $toLong: NumberDecimal("5.5000") }``
132- - NumberLong ("5")
132+ - Long ("5")
133133
134134 * - ``{ $toLong: NumberDecimal("9223372036854775808.0") }``
135135 - Error
136136
137137 * - ``{ $toLong: NumberInt(8) }``
138- - NumberLong (8)
138+ - Long (8)
139139
140140 * - ``{ $toLong: ISODate("2018-03-26T04:38:28.044Z") }``
141- - NumberLong ("1522039108044")
141+ - Long ("1522039108044")
142142
143143 * - ``{ $toLong: "-2" }``
144- - NumberLong ("-2")
144+ - Long ("-2")
145145
146146 * - ``{ $toLong: "2.5" }``
147147 - Error
@@ -156,10 +156,10 @@ Create a collection ``orders`` with the following documents:
156156
157157.. code-block:: javascript
158158
159- db.orders.insert ( [
159+ db.orders.insertMany ( [
160160 { _id: 1, item: "apple", qty: NumberInt(5) },
161161 { _id: 2, item: "pie", qty: "100" },
162- { _id: 3, item: "ice cream", qty: NumberLong(500) },
162+ { _id: 3, item: "ice cream", qty: NumberLong(" 500" ) },
163163 { _id: 4, item: "almonds", qty: "50" },
164164 ] )
165165
@@ -192,13 +192,14 @@ The operation returns the following documents:
192192
193193.. code-block:: javascript
194194
195- { " _id" : 1, " item" : "apple", " qty" : 5, "convertedQty" : NumberLong(5 ) }
196- { " _id" : 2, " item" : " pie", " qty" : " 100", " convertedQty" : NumberLong( 100) }
197- { " _id" : 3, " item" : "ice cream", " qty" : NumberLong(500), " convertedQty" : NumberLong(500 ) }
198- { " _id" : 4, " item" : "almonds", " qty" : "50", " convertedQty" : NumberLong(50 ) }
195+ { _id: 3, item: 'ice cream', qty: Long("500"), convertedQty: Long("500" ) },
196+ { _id: 2, item: ' pie', qty: ' 100', convertedQty: Long(" 100" ) },
197+ { _id: 4, item: 'almonds', qty: '50', convertedQty: Long("50" ) },
198+ { _id: 1, item: 'apple', qty: 5, convertedQty: Long("5" ) }
199199
200200.. note::
201201
202202 If the conversion operation encounters an error, the aggregation
203203 operation stops and throws an error. To override this behavior, use
204204 :expression:`$convert` instead.
205+
0 commit comments