Query Language
The query language allows you to filter, search, and combine conditions to retrieve data. It uses MongoDB-style syntax for defining conditions and logical operations. Below is a guide to the supported operators and how to use them in your queries.
Supported Operators
Operator | Description | Example |
---|---|---|
$eq |
Matches values equal to the specified value. | {"Category": {"$eq": "API Management"}} |
$ne |
Matches values not equal to the specified value. | {"GET": {"$ne": 0}} |
$gt |
Matches values greater than the specified value. | {"Average Word per Sentence": {"$gt": 10}} |
$gte |
Matches values greater than or equal to the specified value. | {"Endpoints Description Coverage": {"$gte": 50}} |
$lt |
Matches values less than the specified value. | {"Commit Date": {"$lt": 2023-08-10}} |
$lte |
Matches values less than or equal to the specified value. | {"Commits": {"$lte": 100}} |
$in |
Matches any value in the specified list. | {"Category": {"$in": ["API Management", "DevOps"]}} |
$nin |
Matches values not in the specified list. | {"Spec Version": {"$nin": ["2.0", "3.0.1"]}} |
$regex |
Matches values using a regular expression. | {"Name": {"$regex": "API.*"}} |
$and |
Combines multiple conditions with logical AND. | {"$and": [{"Category": {"$eq": "API Management"}}, {"GET": {"$eq": 1}}]} |
$or |
Combines multiple conditions with logical OR. | {"$or": [{"Version": {"$eq": "beta"}}, {"Endpoints Description Coverage": {"$gte": 80}}]} |
Examples
Single Condition
Retrieve all records where the category is "API Management":
{"Category": {"$eq": "API Management"}}
Multiple Conditions with AND
Retrieve all APIs that are in their first version in the "API Management" category:
{"$and": [{"Category": {"$eq": "API Management"}}, {"Version": {"$eq": "1.0.0"}}]}
Multiple Conditions with OR
Retrieve APIs with either a coverage of at least 80% or a "beta" version:
{"$or": [{"Endpoints Description Coverage": {"$gte": 80}}, {"Version": {"$eq": "beta"}}]}
Using IN
Retrieve all records where the category is either "API Management" or "DevOps":
{"Category": {"$in": ["API Management", "DevOps"]}}
Using Regular Expressions
Retrieve all records where the name starts with "API":
{"Name": {"$regex": "API.*"}}