Skip to content

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

Interface: ParseToMongoOptions

Properties

allowedKeys?

optional allowedKeys: string[]

A list of allowed keys that can be used in the search query. If provided, any query using keys outside this list will be rejected.


allowEmpty?

optional allowEmpty: boolean

Determines whether empty search queries are allowed. If true, an empty query will return an unfiltered result. If false, an empty query will be rejected.

Default

ts
false

maxOps?

optional maxOps: number

Max of query ops combination.

Default

ts
Infinity

transform?

optional transform: Readonly<Arrayable<ParseToMongoTransformFn>> | Readonly<Record<string, Readonly<Arrayable<ParseToMongoTransformFn>>>>

A transformation function or a mapping of transformation functions to modify query values before they are converted into a MongoDB query.

  • If an array is provided, all functions in the array will be applied.
  • If a record object is provided, transformations will be applied based on the corresponding field key.

Example

ts
{
  'age': MONGO_TRANSFORM.NUMBER
  'customer._id': [MONGO_TRANSFORM.OBJECT_ID, MONGO_TRANSFORM.NOT_NULLABLE]
}