Skip to main content

Interface: ParseMongoDbOptions

react-querybuilder.ParseMongoDbOptions

Options object for parseMongoDB.

Hierarchy

  • ParserCommonOptions

    ParseMongoDbOptions

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


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


getValueSources

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

Type declaration

(field, operator): ValueSources

Parameters
NameType
fieldstring
operatorstring
Returns

ValueSources

Inherited from

ParserCommonOptions.getValueSources

Defined in

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


independentCombinators

Optional independentCombinators: boolean

Inherited from

ParserCommonOptions.independentCombinators

Defined in

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


listsAsArrays

Optional listsAsArrays: boolean

Inherited from

ParserCommonOptions.listsAsArrays

Defined in

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


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