Skip to main content

ParseMongoDbOptions

Options object for parseMongoDB!parseMongoDB.

Extends

  • ParserCommonOptions

Properties

additionalOperators?

optional additionalOperators: Record<`$${string}`, (field: string, operator: string, value: any, options: ParserCommonOptions) => RuleType<string, string, any, string> | RuleGroupType<RuleType<string, string, any, string>, string>>

Map of additional operators to their respective processing functions. Operators must begin with "$". Processing functions should return either a RuleType or RuleGroupType.

(The functions should not return RuleGroupTypeIC, even if using independent combinators. If the independentCombinators option is true, parseMongoDB will convert the final query to RuleGroupTypeIC before returning it.)

Default

{}

Defined in

packages/react-querybuilder/src/types/importExport.ts:418


fields?

optional fields: OptionList<FullField<string, string, string, Option<string>, Option<string>>> | Record<string, FullField<string, string, string, Option<string>, Option<string>>>

Inherited from

ParserCommonOptions.fields

Defined in

packages/react-querybuilder/src/types/importExport.ts:328


getValueSources()?

optional getValueSources: (field: string, operator: string) => ValueSources

Parameters

ParameterType
fieldstring
operatorstring

Returns

ValueSources

Inherited from

ParserCommonOptions.getValueSources

Defined in

packages/react-querybuilder/src/types/importExport.ts:329


independentCombinators?

optional independentCombinators: boolean

Inherited from

ParserCommonOptions.independentCombinators

Defined in

packages/react-querybuilder/src/types/importExport.ts:331


listsAsArrays?

optional listsAsArrays: boolean

Inherited from

ParserCommonOptions.listsAsArrays

Defined in

packages/react-querybuilder/src/types/importExport.ts:330


preventOperatorNegation?

optional preventOperatorNegation: boolean

When true, MongoDB rules in the form of { fieldName: { $not: { <...rule> } } } will be parsed into a rule group with the not attribute set to true. By default (i.e., when this attribute is false), such "$not" rules will be parsed into a rule with a negated operator.

For example, with preventOperatorNegation set to true, a MongoDB rule like this...

{ fieldName: { $not: { $eq: 1 } } }

...would yield a rule group like this:

{
combinator: 'and',
not: true,
rules: [{ field: 'fieldName', operator: '=', value: 1 }]
}

By default, the same MongoDB rule would yield a rule like this:

{ field: 'fieldName', operator: '!=', value: 1 }
// negated operator ^

Default

false

Defined in

packages/react-querybuilder/src/types/importExport.ts:406


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.