On this page本页内容
ObjectId.toString()
Returns the string representation of the 返回ObjectId(). ObjectId()的字符串表示形式。This string value has the format of 此字符串值的格式为ObjectId(...).ObjectId(...)。
The following example calls the 以下示例在toString() method on an ObjectId() instance in mongosh:mongosh中的ObjectId()实例上调用toString()方法:
ObjectId("507c7f79bcf86cd7994f6c0e").toString()
This will return the following string:这将返回以下字符串:
ObjectId("507c7f79bcf86cd7994f6c0e")
You can confirm the type of this object using the following operation:您可以使用以下操作确认此对象的类型:
typeof ObjectId("507c7f79bcf86cd7994f6c0e").toString()