Skip to main content

Query Builder

The Query Builder allows users to create complex queries for MongoDB without writing code. It provides an intuitive interface where you can build, modify, and preview queries directly within the application. This tool is especially useful for users who prefer a graphical interface over traditional query scripting.

Key Features

  • Schema Exploration: Visualize and explore the schema of the entities and their records.
  • Drag-and-Drop Query Building: Create queries by dragging fields from the schema into the query builder.
  • Real-Time Preview: See the results of your query as you build it.
  • Logical Grouping: Combine multiple rules and groups to create advanced queries.
  • Rule Customization: Define custom conditions for each field.
  • Two-Way Sync: Modify the query in the builder or the raw code editor, and see the changes reflected in real-time.

Accessing the Query Builder

  1. Navigate to the Data section in the sidebar.
  2. Select Entity from the list of entities.
  3. Click on the "Query" button query editor open button

Interface Overview

The Visual Query Builder interface is divided into several key sections:

1.Example and Schema (Top Left Panel)

  • Example: Shows a sample document from the entity. example tab

    • You can drag-and-drop fields from the example tab to the Filter builder tab. Rulle will be populated with the field name and value.
    • Search bar allows you to search for fields in the example tab.
    • Arrow buttons allow you to navigate between different example documents.
  • Schema: Displays the schema of the entity. query builder schema tab

    • You can drag-and-drop fields from the schema tab to the Filter builder tab. Rule will be populated with the field name.

    Main difference between Example and Schema tabs is that Example tab shows the actual record from the entity, while Schema tab shows the schema of the entity.

2.Filter Builder (Right Panel) query builder filter panel

  • Drag-and-Drop Interface: Drag fields from the Example or Schema tab to create rules.
  • Logical Operators: Combine rules using AND, OR, and NOT operators.
  • Rule Customization: Define custom conditions for each field.
  • Grouping: Create groups of rules to build complex queries.

3.Result Preview (Bottom Panel) query builder results preview

  • Displays the results of the query in real-time

4.Raw Query Editor (Right Panel) raw query editor

  • Allows advanced users to directly edit the Mongo-like query syntax if they prefer.

Building a Query

Simple Query

  1. Drag a field from the Example or Schema tab to the Filter Builder.
  2. Define the condition for the field.
  3. You can see the results in the Result Preview panel.
  4. You can add more fields and conditions to the query. Rules without any logical operators are combined using the AND operator.
  5. Click on "Save and close" to save the query.

Complex Query

  1. Add group to the query by clicking on the "Add Group" button.
  2. Select the logical operator for the group.
  3. Drag fields to the group and define conditions.
  4. You can nest groups within groups to create complex queries.
  5. Click on "Save and close" to save the query.

Types and Conditions

The Query Builder supports various field types and conditions for building queries.

Number and Date

  • "=" (Equal) - Matches values that are equal to the specified value.
  • "!=" (Not Equal) - Matches values that are not equal to the specified value.
  • ">" (Greater Than) - Matches values that are greater than the specified value.
  • "<" (Less Than) - Matches values that are less than the specified value.
  • ">=" (Greater Than or Equal) - Matches values that are greater than or equal to the specified value.
  • "<=" (Less Than or Equal) - Matches values that are less than or equal to the specified value.
  • "<= ... <=" This condition checks if a value falls within a range that includes both endpoints. For example, if you set the condition as 10 <= field <= 20, it will match all values from 10 to 20, including both 10 and 20. between condition
  • "< ... <=" : This condition checks if a value falls within a range that excludes the lower endpoint but includes the upper endpoint.
  • "<= ... <" : This condition checks if a value falls within a range that includes the lower endpoint but excludes the upper endpoint.
  • "< ... <" : This condition checks if a value falls within a range that excludes both endpoints.
  • "in" (In) - Matches any of the values specified in an array. You can add values by clicking on the "+" button. array input\ You can select type of value in array.
  • "type" (Type) - Matches values based on their BSON type.
  • "empty" (Empty) - Matches fields that are empty or null.
  • "not empty" (Not Empty) - Matches fields that are not empty or null.
  • "exists" (Exists) - Matches fields that exist in the document. exists_condition. There is no "not exists" condition. If you want to find documents where a field does not exist, you must set "exists" to false (disable checkbox).

String

  • "=" (Equal) - Matches values that are equal to the specified value.
  • "!=" (Not Equal) - Matches values that are not equal to the specified value.
  • "in" (In) - Matches any of the values specified in an array. You can add values by clicking on the "+" button.
  • "contains" (Contains) - Matches values that contain the specified substring.
  • "Starts with" (Starts With) - Matches values that start with the specified substring.
  • "Ends with" (Ends With) - Matches values that end with the specified substring.
  • "Type" - Matches values based on their BSON type.
  • "Empty" - Matches fields that are empty or null.
  • "Not Empty" - Matches fields that are not empty or null.
  • "Exists" - Matches fields that exist in the document. There is no "not exists" condition. If you want to find documents where a field does not exist, you must set "exists" to false (disable checkbox).

Boolean

  • "=" (Equal) - Matches values that are equal to the specified value.
  • "!=" (Not Equal) - Matches values that are not equal to the specified value.
  • "Type" - Matches values based on their BSON type.
  • "Empty" - Matches fields that are empty or null.
  • "Not Empty" - Matches fields that are not empty or null.
  • "Exists" - Matches fields that exist in the document. There is no "not exists" condition. If you want to find documents where a field does not exist, you must set "exists" to false (disable checkbox).

Array

  • "=" - Return documents where the array field contains value
  • "=[]" - Return documents where the array field is equal to the specified array regard to order
  • "All" - Return documents where the array field contains all the specified values regadless of order
  • "In" - Return documents where the array field contains any of the specified values
  • "Size" - Return documents where the array field has the specified size
  • "Type" - Matches values based on their BSON type.
  • "Empty" - Matches fields that are empty or null.
  • "Not Empty" - Matches fields that are not empty or null.
  • "Exists" - Matches fields that exist in the document. There is no "not exists" condition. If you want to find documents where a field does not exist, you must set "exists" to false (disable checkbox).
  • "Element Match" - Return documents where the array field contains at least one element that matches the specified condition elements match If you array contains objects, you can specify conditions for each field of object.