Skip to main content

ParseMongoDbOptions

Defined in: packages/react-querybuilder/src/types/importExport.ts:374

Options object for parseMongoDB!parseMongoDB.

Extends

  • ParserCommonOptions

Properties

additionalOperators?

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

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

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

{}

fields?

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

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

Inherited from

ParserCommonOptions.fields


getValueSources()?

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

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

Parameters

ParameterType
fieldstring
operatorstring

Returns

ValueSources

Inherited from

ParserCommonOptions.getValueSources


independentCombinators?

optional independentCombinators: boolean

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

Inherited from

ParserCommonOptions.independentCombinators


listsAsArrays?

optional listsAsArrays: boolean

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

Inherited from

ParserCommonOptions.listsAsArrays


preventOperatorNegation?

optional preventOperatorNegation: boolean

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

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

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.