- Reference >
mongo
Shell Methods >- Object Constructors and Methods >
- ObjectId.toString()
ObjectId.toString()¶
On this page
-
ObjectId.
toString
()¶ Returns the string representation of the
ObjectId()
. This string value has the format ofObjectId(...)
.
Example¶
The following example calls the toString()
method
on an ObjectId()
instance in the mongo
shell:
This will return the following string:
You can confirm the type of this object using the following operation: