Skip to main content
Version: 8.3 Beta 🚧

toObjectId

This function is used by Ignition's Expression language.

Description​

Converts String to org.bson.types.ObjectId.

Syntax​

toObjectId(stringId)

TypeParameterDescription
StringstringIdA 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​

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