翻译或纠错本页面

UUID()

On this page

Definition

UUID(<string>)

Generates a BSON UUID object.

Parameter Type Description
hex string Specify a 32-byte hexadecimal string to convert to the UUID BSON subtype.
返回:A BSON UUID object.

Example

Create a 32 byte hexadecimal string:

var myuuid = '0123456789abcdeffedcba9876543210'

Convert it to the BSON UUID subtype:

UUID(myuuid)
BinData(3,"ASNFZ4mrze/+3LqYdlQyEA==")
←   Date() ObjectId  →