Skip to content

Commit 8657ef6

Browse files
committed
DOCS-948 NumberLong in shell
1 parent abde0fa commit 8657ef6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

source/core/shell-types.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,28 @@ the following operation in the :program:`mongo` shell:
136136
.. see:: :doc:`/core/object-id` for full documentation of ObjectIds in
137137
MongoDB.
138138

139+
.. _shell-type-long:
140+
141+
NumberLong
142+
----------
143+
144+
The :program:`mongo` shell provides the ``NumberLong()`` class to handle
145+
numbers of type long.
146+
147+
The ``NumberLong()`` accepts the long as a string:
148+
149+
.. code-block:: javascript
150+
151+
NumberLong("20908458868526654")
152+
153+
The following examples use the ``NumberLong()`` class to write to the
154+
collection:
155+
156+
.. code-block:: javascript
157+
158+
db.collection.insert( { _id: 10, calc: NumberLong("20908458868526654") } )
159+
db.collection.update( { _id: 10 },
160+
{ $set: { calc: NumberLong("209084588685266550") } } )
139161

140162
.. wiki content -- I don't think the following applies anymore
141163

0 commit comments

Comments
 (0)