Skip to main content

formatQuery()

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny): string

Generates a formatted (indented two spaces) JSON string from a query object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny

Returns

string

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:131

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized" | FormatQueryOptions & { format: "parameterized"; }): ParameterizedSQL

Generates a ParameterizedSQL object from a query object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"parameterized" | FormatQueryOptions & { format: "parameterized"; }

Returns

ParameterizedSQL

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:135

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized_named" | FormatQueryOptions & { format: "parameterized_named"; }): ParameterizedNamedSQL

Generates a ParameterizedNamedSQL object from a query object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"parameterized_named" | FormatQueryOptions & { format: "parameterized_named"; }

Returns

ParameterizedNamedSQL

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:142

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonlogic" | FormatQueryOptions & { format: "jsonlogic"; }): RQBJsonLogic

Generates a JsonLogic object from a query object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"jsonlogic" | FormatQueryOptions & { format: "jsonlogic"; }

Returns

RQBJsonLogic

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:149

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "elasticsearch" | FormatQueryOptions & { format: "elasticsearch"; }): Record<string, any>

Generates an ElasticSearch query object from an RQB query object.

NOTE: Support for the ElasticSearch format is experimental. You may have better results exporting "sql" format then using ElasticSearch SQL.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"elasticsearch" | FormatQueryOptions & { format: "elasticsearch"; }

Returns

Record<string, any>

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:160

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb_query" | FormatQueryOptions & { format: "mongodb_query"; }): Record<string, any>

Generates a MongoDB query object from an RQB query object.

This is equivalent to the "mongodb" format, but returns a JSON object instead of a string.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"mongodb_query" | FormatQueryOptions & { format: "mongodb_query"; }

Returns

Record<string, any>

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:171

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb" | FormatQueryOptions & { format: "mongodb"; }): string

Generates a JSON.stringify'd MongoDB query object from an RQB query object.

This is equivalent to the "mongodb_query" format, but returns a string instead of a JSON object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"mongodb" | FormatQueryOptions & { format: "mongodb"; }

Returns

string

Deprecated

Use the "mongodb_query" format for greater flexibility.

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:184

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonata" | FormatQueryOptions & { format: "jsonata"; }): string

Generates a JSONata query string from an RQB query object.

NOTE: The parseNumbers option is recommended for this format.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"jsonata" | FormatQueryOptions & { format: "jsonata"; }

Returns

string

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:193

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions): string

Generates a formatted (indented two spaces) JSON string from a query object.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
optionsFormatQueryOptions

Returns

string

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:200

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: "json" | "sql" | "json_without_ids" | "mongodb" | "cel" | "spel" | "natural_language"): string

Generates a query string in the requested format.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
options"json" | "sql" | "json_without_ids" | "mongodb" | "cel" | "spel" | "natural_language"

Returns

string

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:204

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & { format: "json" | "sql" | "json_without_ids" | "mongodb" | "cel" | "spel" | "natural_language"; }): string

Generates a query string in the requested format.

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
optionsFormatQueryOptions & { format: "json" | "sql" | "json_without_ids" | "mongodb" | "cel" | "spel" | "natural_language"; }

Returns

string

Defined in

packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:211


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.