Skip to content

Commit fecdd48

Browse files
DOCSP-45058-mongosh-undefined-behavior (#364)
* DOCSP-45058-mongosh-undefined-behavior * render fixes * render fix * make docs plural * reword * clarify * reviewer changes * .
1 parent a43ec52 commit fecdd48

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

source/reference/compatibility.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,30 @@ in ``mongosh`` better align with the types used by the MongoDB Drivers.
202202
For more information on managing types, refer to the
203203
:manual:`schema validation overview </core/schema-validation>`.
204204

205+
Undefined Values
206+
----------------
207+
208+
The undefined BSON type is `deprecated <https://bsonspec.org/spec.html>`__ in
209+
:binary:`bin.mongosh`. If you insert a document with the undefined JS type in
210+
:binary:`bin.mongosh`, your deployment replaces the undefined value in your
211+
document with the BSON null value. There is no supported way of inserting undefined
212+
values into your database using :binary:`bin.mongosh`.
213+
214+
For example, consider running the following code to insert a document in
215+
:binary:`bin.mongosh`:
216+
217+
.. code-block:: javascript
218+
219+
db.people.insertOne( { name : "Sally", age : undefined } )
220+
221+
When you run this code in :binary:`bin.mongosh`, the shell inserts
222+
the following document:
223+
224+
.. code-block:: javascript
225+
"copyable: false
226+
227+
{ name : "Sally", age : null }
228+
205229
Object Quoting Behavior
206230
-----------------------
207231

0 commit comments

Comments
 (0)