Documentation for version v72
Segmentation by profile structure
Description
You can create queries to MongoDB for complex segmentation of profiles by JSON fields.To create a query, set the following conditions for your segment:
Selection by — Profile Structure
Selection condition — EJSON Request
Next, describe the request in the EJSON format.

Operators
Various operators are used for an extended JSON database query. You can read more about EJSON for MongoDB in the documentation. Below we will show you how to work with the main operators.
For example, the database has a profile with an additional JSON field — "list":

This field contains the following array:
[
{
"contract_id": 10,
"category": "A",
"payment": 1000
}
]
The tables show queries that will allow you to select a given profile from the database:
Comparison operators
| Operator | Description | Example |
|---|---|---|
| $eq | Matches values that are equal to a specified value. | { |
| $ne | Matches all values that are not equal to a specified value. | { |
| $gt | Matches values that are greater than a specified value. | <br/> "list.payment": { |
| $gte | Matches values that are greater than or equal to a specified value. | { |
| $lt | Matches values that are less than a specified value. | { |
| $lte | Matches values that are less than or equal to a specified value. | { |
| $in | Matches any of the values specified in an array. | { |
| $nin | Matches none of the values specified in an array. | { |
Logical operators
| Operator | Description | Example |
|---|---|---|
| $and | Joins query clauses with a logical AND returns all documents that match the conditions of both clauses. | { |
| $not | Inverts the effect of a query expression and returns documents that do not match the query expression. | { |
| $or | Joins query clauses with a logical OR returns all documents that match the conditions of either clause. | { |
| $nor | Joins query clauses with a logical NOR returns all documents that fail to match both clauses. | { |