Skip to content

Documentation / @andrew_l/search-query-language / MONGO_TRANSFORM

Variable: MONGO_TRANSFORM

const MONGO_TRANSFORM: Readonly<object>

Utility transform functions

Type declaration

BOOLEAN

readonly BOOLEAN: ParseToMongoTransformFn

Validates that the value is a boolean. If the value is null, it returns null without throwing an error.

Throws

If the value is not a valid boolean.

DATE

readonly DATE: ParseToMongoTransformFn

Validates and converts the value to a Date. Supports string and number inputs for conversion. If the value is null, it returns null without throwing an error.

Throws

If the value is not a valid date.

NOT_NULLABLE

readonly NOT_NULLABLE: ParseToMongoTransformFn

Ensures the value is not null. Throws an error if the value is null.

Throws

If the value is null.

NUMBER

readonly NUMBER: ParseToMongoTransformFn

Validates that the value is a number. If the value is null, it returns null without throwing an error.

Throws

If the value is not a valid number.

OBJECT_ID

readonly OBJECT_ID: ParseToMongoTransformFn

Validates and converts the value to a MongoDB ObjectId. If the value is null, it returns null without throwing an error.

Throws

If the value is not a valid ObjectId.

STRING

readonly STRING: ParseToMongoTransformFn

Validates that the value is a string. If the value is null, it returns null without throwing an error.

Throws

If the value is not a valid string.