- Reference >
mongoshMethods >- Object Constructors and Methods >
- UUID()
UUID()¶
On this page
Definition¶
Generates a BSON UUID object.
UUID() has the following syntax:
-
UUID(<string>)¶ Parameter Type Description hexstring Optional. Specify a 36 character string to convert to a UUID BSON object. If not provided, MongoDB generates a random UUID in RFC 4122 v4 format.
Changed in version 3.6: In earlier versions of
mongosh,UUIDrequired a hexadecimal string argument. See the 3.4 manual.Returns: A BSON UUID object.