- Reference >
mongoShell Methods >- Object Constructors and Methods >
- ObjectId.valueOf()
ObjectId.valueOf()¶
On this page
-
ObjectId.valueOf()¶ Returns the value of the
ObjectId()as a lowercase hexadecimal string. This value is thestrattribute of theObjectId()object.
Example¶
The following example calls the valueOf() method on an ObjectId():
This will return the following string:
You can confirm the type of this object using the following operation: