Skip to main content

formatQuery()

Call Signature

formatQuery(ruleGroup: RuleGroupTypeAny): string

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:158

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

Parameters

ParameterType
ruleGroupRuleGroupTypeAny

Returns

string

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:162

Generates a ParameterizedSQL object from a query object.

Parameters

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

Returns

ParameterizedSQL

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:169

Generates a ParameterizedNamedSQL object from a query object.

Parameters

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

Returns

ParameterizedNamedSQL

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:176

Generates a JsonLogic object from a query object.

Parameters

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

Returns

RQBJsonLogic

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:187

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>

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:198

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>

Call Signature

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

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

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.

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:220

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

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:227

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

Parameters

ParameterType
ruleGroupRuleGroupTypeAny
optionsFormatQueryOptions

Returns

string

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:231

Generates a query string in the requested format.

Parameters

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

Returns

string

Call Signature

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

Defined in: packages/react-querybuilder/src/utils/formatQuery/formatQuery.ts:238

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


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.