@@ -20,11 +20,8 @@ In this guide, you can learn how to create BSON documents, read BSON from a file
20
20
and write BSON to a file by using the {+driver-short+}.
21
21
22
22
**BSON**, or Binary JSON, is the data format that MongoDB uses to organize
23
- and store data. This data format includes all JSON data structure types and
24
- adds support for types including dates, different size integers, ObjectIds, and
25
- binary data. You can use BSON documents in your {+language+} application by importing the
26
- BSON package. For a complete list of supported types, see the
27
- :manual:`BSON Types </reference/bson-types>` server manual page.
23
+ and store data. You can use BSON documents in your {+language+} application
24
+ by importing the BSON package.
28
25
29
26
The code samples in this guide use the following BSON document as an example:
30
27
@@ -40,6 +37,27 @@ The code samples in this guide use the following BSON document as an example:
40
37
"name" : "Mongo's Pizza"
41
38
}
42
39
40
+ BSON Data Types
41
+ ---------------
42
+
43
+ BSON supports all JSON data structure types and adds support for types including
44
+ dates, different size integers, ``ObjectId``, and binary data. For a complete list of
45
+ supported types, see the :manual:`BSON Types </reference/bson-types>` page in the
46
+ {+mdb-server+} Manual.
47
+
48
+ Universally Unique IDs (UUIDs)
49
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50
+
51
+ The {+driver-short+} supports UUIDs by using the BSON Binary subclass ``UUID``. You
52
+ can create a ``UUID`` object by using the ``UUID()`` constructor. The following code
53
+ example generates a random UUID:
54
+
55
+ .. code-block:: javascript
56
+
57
+ import { UUID } from 'mongodb';
58
+
59
+ const myUuid = new BSON.UUID();
60
+
43
61
Create a BSON Document
44
62
----------------------
45
63
@@ -137,5 +155,7 @@ API Documentation
137
155
-----------------
138
156
139
157
To learn more about any of the methods or types discussed in this
140
- guide, see the `BSON <{+api+}/modules/BSON.html>`__ API documentation.
158
+ guide, see the following API documentation:
141
159
160
+ - `BSON <{+api+}/modules/BSON.html>`__
161
+ - `UUID <{+api+}/classes/BSON.UUID.html>`__
0 commit comments