Skip to main content
Version: 8.1

toObjectId

This function is used by Ignition's Expression language.

Description

Converts String to org.bson.types.ObjectId.

Syntax

toObjectId(stringId)

  • Parameters

    • 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

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