LogoLogo
Home
Core Platform
Core Platform
  • Introduction
    • Overview
    • Use Cases
    • Architecture
    • Built with ML & AI
    • Quick Start
  • Examples
    • Training Examples
      • API Flow Examples
      • Microservice Examples
      • UI Example
      • Exercise: Hello World API
      • Exercise: Test State
      • Exercise: Test UI
    • Exercise: To-do List
      • To-do List Runner
      • To-do List Gateway
      • To-do List UI
      • To-do List Query
  • Troubleshooting
    • Rierino Packages
    • Release Notes
    • Useful Checks
    • Error Codes
  • Devops
    • Overview
    • API Flows
      • Using the Saga Screen
      • Defining a Saga
      • Configuring Saga Steps
        • Event Step
        • Transform Step
          • Transform Classes
        • Condition Step
          • Condition Classes
        • Step Link
      • Injecting Variables
    • Microservices
      • Runners
        • Using the Runner Screen
        • Defining a Runner
        • Managing Runner Settings
        • Adding Runner Elements
        • Deploying Runners
          • Spring Runners
          • Samza Runners
          • Camel Runners
      • Elements
        • Systems
        • State Managers
          • Typical Use Cases
          • State Data Structure
          • Local States
            • In-Memory Map
            • Caffeine Cache
            • Samza Based
            • Lucene Based
            • Single File
            • Multiple Files
            • Selected IDs Map
            • Indexed Map
          • Shared States
            • MongoDB Collection
            • Jooq (SQL) Table
            • Redis Map
            • Couchbase Collection
            • Elasticsearch Index
            • Elasticsearch Joined
            • Etcd Namespace
          • Specialized States
            • CRUD Service
            • Odata Service
          • State Coordinators
            • Lazy Cache Coordinator
            • Event Store Coordinator
            • Write thru Coordinator
          • Loading Strategies
          • ID Generators
        • Listeners
        • Query Managers
          • MongoDB
          • Elasticsearch
          • Lucene
          • SQL Based
          • Odata Service
        • Handlers
          • Core Handlers
            • Write Data
            • Read Data
            • Query Data
            • Apply Rules
            • Call Rest API
            • Generate Text/Html
            • Parse Html
            • Generate Secrets
            • Orchestrate User Task
            • Perform File Operation
            • Run Shell Command
            • Send/Receive Emails
          • Custom Code Handlers
            • Run Scripts
            • Run Java Code
            • Run Java Package
          • Flow Handlers
            • Orchestrate Saga
            • Loop Each Entry
            • Run Multiple Steps
            • Buffer Payloads
            • Merge Parallel Steps
            • Log Event
            • Send Event
            • Validate Event
            • Transform Event
            • Perform DB Transaction
            • Trigger Runner Command
            • Do Nothing
            • Modify Role Data
            • Enrich Role Data
            • Convert Pulse to Journal
          • Gateway Handlers
            • Authenticate
              • No Authentication
              • State Based
              • Keycloak Based
            • Sessionize
          • Specialized Handlers
            • Apply Advanced Rules
            • Calculate Real-time Metrics
            • Score ML Models
            • Score LangChain Models
            • Service MCP Requests
            • Service A2A Requests
            • Consume Web of Things
            • Perform Text Embedding
            • Run Python Procedure
            • Generate Excel
            • Generate PDF
            • Call SOAP API
            • Integrate with Camel
        • Actions
        • Streams
          • Kafka Topic
          • CDC Feed
          • Camel Component
        • Roles
        • Generic Settings
        • Global Settings
      • Deployments
        • Defining a Deployment
        • Alternative Loaders
    • Gateway & Security
      • Gateway Servers
        • Gateway Systems
        • Gateway Channels
        • Gateway Services
        • Gateway Tokens
      • APIs
        • OpenAPI Specification
        • Response Formats
    • Administration
      • Managing Deployments
      • Sending Commands
      • Streaming Messages
      • Migrating Assets
    • Batch Tasks
      • Python Processes
      • Python Iterators
      • Python Processors
    • Pro-Code
      • Custom Handlers
      • Custom State Managers
      • Custom Query Managers
      • Custom CDC Managers
  • Design
    • Overview
    • User Interface
      • Apps
      • UIs
        • Listers
        • Widgets
          • Value Widgets
          • Array Widgets
          • Object Widgets
          • Indirect Widgets
          • Atom Widgets
        • Menus
          • Lister Menu Actions
          • Selection Menu Actions
          • Editor Menu Actions
          • Widget Menu Actions
          • Custom Menu Actions
          • RAI Menu Actions
        • Extended Scope
          • Conditional Display
          • Data Context
          • Extra Data
          • Default Item
          • Extra Events
      • Options
      • Translations
      • Icons
      • Styles
      • Components
    • API Mapping
    • Data Schema
      • Common Data
  • Configuration
    • Overview
    • Queries
      • Query Types
      • Query Platforms
        • MongoDB Queries
        • Odata Queries
        • SQL Queries
        • Elasticsearch Queries
        • Lucene Queries
        • Siddhi Queries
    • Business Rules
      • Drools Rules
    • Dynamic Handlers
  • Data Science
    • Overview
    • ML Models
      • Scheduler Platforms
        • Airflow Scheduler
    • GenAI Models
    • MCP Servers
    • Complex Event Processing
      • Siddhi Data Flows
    • Data Visualizations
    • Customizations
  • EXTENSIONS
    • JMESPath
    • Handlebars
Powered by GitBook

© Rierino Software Inc. 2025. All rights reserved.

On this page
  • Query Parameters
  • Join Parameters
  • Simple Lookup
  • Complex Lookup
  • Common Mongo Parameters
  • Field Parameters
  • Custom Condition Operators
  • Custom Pipeline Steps
  • Examples
  1. Configuration
  2. Queries
  3. Query Platforms

MongoDB Queries

These queries are converted to MongoDB filters and aggregations by MongoQueryProducer.

PreviousQuery PlatformsNextOdata Queries

Last updated 11 months ago

These queries support all available query types and convert them to Bson maps or lists for execution. Pipeline queries are treated as aggregate pipelines and bundled queries are treated as facets.

MongoDB specific features for special use cases are as follows:

Query Parameters

Parameter
Definition

matchAfterJoin

Whether the where condition should execute after joins or before (i.e. on main collection), defaults to false

pipe

Whether the query should be generated as an aggregate pipeline instead of a find query

When there is a join condition on a query, it is automatically produced as an aggregate pipeline. The "pipe" parameter is only recommended when some aggregate operators will be used on an otherwise basic query.

Join Parameters

MongoDB query manager translates joins into $lookup statements, with 2 alternative methods:

Simple Lookup

The simple lookup method uses only a simple "EQ" type condition, where localField of "from" collection maps to "Expression" and foreignField of "join" collection maps to "Value".

Complex Lookup

The complex method uses pipeline feature of MongoDB lookups, where 2 alternative approaches can be used:

Using Parameters

With this approach, lookup pipeline can be manually configured using the following condition parameters:

Parameter
Definition

let

Map of variables to expressions as "let" statement in "$lookup" stage (e.g. {"id":"$_id"})

pipeline

List of steps for "pipeline" to run on joined collection in "$lookup" stage (as array node or string)

Using Join Condition

When a complex condition is used for joining with a collection in query designer (e.g. using AND, OR or anything other than EQ operator), MongoDB query manager automatically translates the join into a pipeline based lookup. This option allows using regular conditions (including ability to use parameters such as required variables), which will be automatically translated into $match statements.

When using this approach, it is possible to add the following parameters:

Parameter
Definition

let

Map of variables to expressions as "let" statement in "$lookup" stage (e.g. {"id":"$_id"})

extra

List of steps for adding to "pipeline" after the produced $match statement (as array node or string)

Common Mongo Parameters

Following parameters are applicable in various building blocks of a MongoDB query:

Parameter
Definition

mongo

Json object to be used as the field expression

mongo.inject

Whether "mongo" parameter should be injected with variables

mongoJson

Json string to be used as the field expression

Whether "mongoJson" parameter should be parsed into a json object before injection

mongoJson.inject

Whether "mongoJson" parameter should be injected with variables

Field Parameters

For both custom simple and aggregation fields, "Common Mongo Parameters" are applicable.

In defining field expressions for simple and aggregation fields, it is possible to use any MongoDB expression.

However, if the first character is a "$", it should be omitted (e.g. instead of $id, expression should be id, instead of $$ROOT, expression should be $ROOT). Query manager automatically adds a "$" character, if the first character is not "{". This convention is used to allow more standardized expressions between different systems.

Custom Condition Operators

For simple conditions, MongoDB supports following custom operators:

  • value: Uses "filter" parameter (e.g. $eq) as the check between rhs and lhs values of the condition.

  • values: Same as value operator, accepting multiple values as the rhs.

  • bson: Uses "Common Mongo Parameters" to build a Bson statement as the condition.

It is also possible to use any mongodb operator (e.g. $exists) as a custom operator, which uses a single rhs value (e.g. "true") along with the lhs (e.g. data.records).

MongoDB Java driver automatically hides "$and" operator in certain scenarios in older versions of the library (i.e. when multiple entries with same key doesn't exist). This can result in issues in rare complex condition scenarios (e.g. $not allowed as a root level operator). In such case, conditions inside the AND operator can be written as custom expressions instead.

Custom Pipeline Steps

For pipeline steps, MongoDB supports following types:

  • custom: Pipeline step is produced directly from "Common Mongo Parameters" of the step content.

  • condition: Step content represents "where" condition of a query.

  • join: Step content represents "join" condition of a query.

  • select: Step content represents "fields" of a simple query.

  • aggregate: Step content represents "fields" of an aggregation query.

  • orderBy: Step content represents "orderBy" of a query.

  • skip: Uses "value" text field of the step content to skip number of records.

  • limit: Uses "value" text field of the step content to limit number of records.

Examples

$lookup (aggregation)mongodb
MongoDB $lookup
Logo
Operatorsmongodb
MongoDB Operators
Logo
527B
customer_segments.json
Select Customer Segment by Id (Can be Imported on Query Screen)
7KB
product_detail_query.json
Product Details with Joins and Expressions (Can be Imported on Query Screen)
5KB
product_list_bundle.json
Product List with Bundled Total Count (Can be Imported on Query Screen)
6KB
product_variant_feed_es.json
Pipeline with Unwind (Can be Imported on Query Screen)
Example Simple Lookup