Skip to main content

ParseMongoDbOptions

Options object for parseMongoDB.

Extends

  • ParserCommonOptions

Properties

additionalOperators?

optional additionalOperators: Record<`$${string}`, (field, operator, value, options) => 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:393


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:303


getValueSources()?

optional getValueSources: (field, operator) => ValueSources

Parameters

ParameterType
fieldstring
operatorstring

Returns

ValueSources

Inherited from

ParserCommonOptions.getValueSources

Defined in

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


independentCombinators?

optional independentCombinators: boolean

Inherited from

ParserCommonOptions.independentCombinators

Defined in

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


listsAsArrays?

optional listsAsArrays: boolean

Inherited from

ParserCommonOptions.listsAsArrays

Defined in

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


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:381


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.