--- title: "toObjectId" description: "Converts String to org.bson.types.ObjectId." --- # toObjectId > Converts String to org.bson.types.ObjectId. **This function is used by Ignition's Expression language.** ## Description ## Syntax `toObjectId(stringId)` | Type | Parameter | Description | |---|---|---| | String | `stringId` | A unique, 24 character string identifier that matches with an id of an existing document of a collection. | ### Results **ObjectId** - A unique, 12 byte identifier that matches with an id of an existing document of a collection in both value and data type. ## Example ```py title="Code Snippet" // In a Perspective MongoDB Binding, the expression below is applied to “value” of // filter { _id: “value” } toObjectId("5553a998e4b02cf7151190b8") // binding will return entire document of the matching _id ```