ToObjectId constructor

ToObjectId(
  1. dynamic expr
)

Creates $toObjectId operator expression

Converts a value to an ObjectId. If the value cannot be converted to an ObjectId, $toObjectId errors. If the value is null or missing, $toObjectId returns null.

The ToObjectId takes any valid expression.

Implementation

ToObjectId(expr) : super('toObjectId', expr);