LogoLogo
  • Introduction
  • Features
  • Getting Started
    • Cortex User Guide
      • Organizations
      • Log in
      • Generate an API key
      • Make your first API request
      • Configure the org settings
      • Set up a data model
        • Create custom objects
        • Add custom properties
      • One-to-many relationships
      • Read and write data
      • Making a Request
      • Handling responses
      • Authentication
      • Two-factor authentication
      • Set third-party cookies
      • Connections
      • Upload files
      • Cortex iOS
      • Get started with Swift
      • Cortex service accounts
      • Cortex developer tools
      • Automated Account Notifications
  • Cortex API
    • Overview
    • Objects
      • Objects Overview
      • Organization
      • Account
      • Connections
      • Notifications
      • Stats
      • Logs
      • Export
      • Events
      • Room
    • Object Definition
      • Object Properties
        • Any
        • Binary
        • Boolean
        • Date
        • Document
        • File
        • Geometry
        • List
        • Number
        • ObjectId
        • Reference
        • String
    • Object Types
    • Access Control
    • Querying
      • Query Operators
      • Property Selection
      • Property Access
    • Aggregating
      • Aggregation Operators
    • Scripting
      • Script Types
      • Script Limits
      • ObjectId
      • CortexObject
        • Accounts
        • Views
      • Cursors
      • Operations
      • Script Modules
        • API Module
        • Base64 Module
        • Cache Module
        • Connections Module
        • Console Module
        • Consts Module
        • Counters Module
        • Crypto Module
        • HTTP Module
        • Logger Module
        • Notifications Module
        • Request Module
        • Response Module
        • SAML Module
        • Schemas Modules
        • Script Module
        • Session Module
        • Util.id Module
        • Util.ip Module
        • Util.paths Module
        • XML Module
        • Developer
        • Config
        • Renderer
        • SFTP
        • FTP
        • DB
          • Cursors
          • Driver
      • Static Methods
        • Accounts
        • Views
        • Cursors
      • Audit
      • Environments
      • HTTP Driver
      • Notifications
        • Firebase Cloud Messaging (FCM)
        • Tencent Push Notification Service Configuration
      • Televisit
      • Transforms
      • Localization
      • Available Javascript Libraries
    • Decorators
      • Runtime
        • Acl
        • As
        • Log
        • Profile
      • Static
        • Env
        • Job
        • Object
        • On
        • Policy
        • Route
        • Transform
        • Trigger
    • Expressions
      • Primer
      • Pipelines
      • Operators
      • Accumulators
      • Variables
      • Conditionals
      • Transforms
      • Triggers
      • On
      • Events
    • Faults
      • Fault Reference
  • Releases
    • Cortex Release Notes
      • Cortex API 2.28.3 (R3.4.6)
      • Cortex API 2.28.1 (R3.4.3)
      • Cortex API 2.27.2 (R3.4.1)
      • Cortex API 2.27.1 (R3.3.5)
      • SQL DB Connector 1.3.4 (R3.3.3)
      • Cortex API 2.26.2 (R3.3.1)
      • Cortex API 2.26.1 (R3.2.2)
      • Cortex API 2.26.0 (R3.2.1)
      • SQL DB Connector 1.3.3
      • Cortex API 2.25.0 (R3.1.1)
      • SQL DB Connector 1.3.2 (R3.1.0)
      • Cortex API 2.24.2 (R3.0.2)
      • SQL DB Connector 1.3.1 (R3.0.0)
      • Cortex API 2.24.1 (R2.3.3)
      • Cortex API 2.24.0 (R2.3.2)
      • SQL DB Connector 1.3.0 (R2.3.0)
      • Cortex API 2.23.0 (R2.2.4)
      • SQL DB Connector 1.2.0 (R2.2.0)
      • Cortex API 2.22.2 (R2.1.2)
      • Cortex API 2.22.1 and SQL DB Connector 1.1.1 (R2.0.1)
      • Cortex API 2.22.0
      • Cortex API 2.21.3
      • Cortex API 2.21.2
      • Cortex Web 4.16.0
      • Cortex Web 4.15.1
      • Cortex API 2.20.1
      • Cortex Web 4.14.0
      • Cortex Renderer 1.3.3
      • Cortex API 2.19.4
      • Cortex API 2.19.3 and Cortex Web 4.13.1
      • Cortex Renderer 1.3.2
      • Cortex API 2.19.1
      • Cortex API 2.18.0
      • Cortex API 2.17.6
      • Cortex API 2.17.5
      • Cortex API 2.17.4
      • Cortex API 2.17.3
      • Cortex API 2.17.2
      • Cortex API 2.17.1
      • Cortex API 2.16.0
      • Cortex API 2.15.9
      • Cortex API 2.15.8-1
      • Cortex 2.15.8
      • Cortex API 2.18.1
      • Cortex API 2.16.1
      • Cortex Renderer 1.3.1
      • Cortex Renderer 1.3.0
      • Cortex Renderer 1.2.2
      • Cortex Renderer 1.2.1
      • Cortex Renderer 1.2.0
    • Third-Party License Attribution

© 2025 Medable, Inc. All rights reserved.

On this page
  • Usage
  • Query Operator Types
  • Comparison Operators
  • Logical Operators
  • Evaluation Operators
  • Geospatial Operators
  • Array Operators

Was this helpful?

  1. Cortex API
  2. Querying

Query Operators

Query operators can be used to construct query conditions in order to find data. Query operators are typically applied to a property and take a value or a document defining the conditions of the operation.

For example:

{<property>: {<operator>: value}}

Or:

{<property>: {<operator>: {<option>: <value>, <option>: value, ...}}}

Or, in the case of logical operators (e.g. $and, $or), the operator takes an array of expressions:

{<operator>: [{<expression>}, {<expression>}, ...]}

Usage

Query operators can be used in a where query argument or in a $match pipeline stage .

When used in a where query argument, the request looks similar to the following:

GET /<object>?where={<query conditions>}

When used in a $match pipeline stage, the request looks similar to the following:

GET /<object>?pipeline=[{"$match":{<query conditions>}}]

Query Operator Types

Type

Description

Comparison Operators

For filtering results based on value comparisons.

Logical Operators

Join query clauses together or invert the meaning of a query expression

Evaluation Operators

Filter results based on the result of a regular expression

Geospatial Operators

Find locations within a distance of a central location.

Array Operators

Match on arrays, elements in an array, or size of arrays.

Comparison Operators

Operator

Description

Example

$eq

Selects documents where the value of the property is equal to the passed in value.

{“c_bpm”: {“$eq”: 70}}

$gt

Selects documents where the value of the property is greater than the passed in value.

{“c_bpm”: {“$gt”: 70}}

$gte

Selects documents where the value of the property is greater than or equal to the passed in value.

{“c_bpm”: {“$gte”: 70}}

$lt

Selects documents where the value of the property is lesser than the passed in value.

{“c_bpm”: {“$lt”: 70}}

$lte

Selects documents where the value of the property is lesser than or equal to the passed in value.

{“c_bpm”: {“$lte”: 70}}

$ne

Selects documents where the value of the property is not equal to the passed in value.

{“c_bpm”: {“$ne”: 70}}

$in

Selects documents where the property matches any of the passed in values.

{“c_bpm”: {“$in”: [65, 66, 67, 68, 69, 70]}}

$nin

Selects documents where the property matches none of the passed in values.

{“c_bpm”: {“$nin”: [65, 66, 67, 68, 69, 70]}}

Logical Operators

Operator

Description

Example

$and

Selects documents where all passed in conditions are met.

{“$and”: [{“c_bpm”: {“$gt”: 70}}, {“c_bpm”: {“$lt”: 100}}] }

$or

Selects documents where any passed in conditions are met.

{“$or”: [{“c_bpm”: {“$gt”: 70}}, {“c_bmi”: {“$gt”: 24.9}}] }

$not

Evaluates to true if the property or expression evaluates to false.

{“$not”: “c_active”}

$nor

Selects documents where none of the passed in conditions are met.

{“$nor”: [{“c_bpm”: {“$gt”: 70}}, {“c_bmi”: {“$gt”: 24.9}}] }

Evaluation Operators

Operator

Description

Example

$regex

Selects documents where the string property matches the passed in regular expression.

{“name.first”: {“$regex”: “/^samplename/i”}}

Geospatial Operators

Operator

Description

Example

$within

Selects documents with geospatial data that exists entirely within a specified shape.

{"c_location": {"$within": {"$center": [-122.143019, 37.441883], "$radius": 10}}}

Array Operators

Operator

Description

Example

$all

Selects documents where the array property contains all of the passed in values.

{“roles”: {“$all”: [“000000000000000000000007”, “0123456789ab0123456789ab”]}}

$elemMatch

Selects documents where all properties of an array of document properties match the passed in expression. $elemMatch does not limit the results within the array, but filters the entire document for contained entries.

{“c_docs”: {“$elemMatch”: {“c_foo”: “yes”, “c_bar”: true}}}

$size

Selects documents where the size of the array property matches the passed in values.

{“c_arr”: {“$size”: 20}}

Last updated 3 years ago

Was this helpful?