On this page本页内容
Generates a BSON UUID object.生成BSON UUID对象。
UUID()
has the following syntax:语法如下所示:
hex |
string |
|
returns: | A BSON UUID object. |
---|
Create a 36 character string you wish to convert to a UUID:创建要转换为UUID的36个字符的字符串:
The following command outputs the 以下命令将myuuid
variable as a BSON UUID object:myuuid
变量作为BSON UUID对象输出:
This command generates the following output:此命令生成以下输出:
You can run the UUID()
method without specifying an argument to generate a random UUID:
This command outputs a random UUID in the following form:此命令以以下形式输出随机UUID:
Changed in version 3.6:In earlier versions of the mongo
shell, UUID
required a hexadecimal string argument.