Skip to content
This page View Markdown Open in ChatGPT Open in Claude

Query for get data

The code in every language

Each example is the inside of main, written in every language API Maker runs : pick yours in the tabs, and every page shows it from then on. The types a call takes (GetAll, DeepItem…) are those of am : from am import GetAll in Python, use am::GetAll; in Rust, import am.GetAll; in Java and Kotlin ; PHP and C# have them without an import, Go names them am.GetAll.

Simple query

Simple query to get data
1
2
3
4
5
6
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
});
Simple query to get data
1
2
3
4
5
6
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
)
Simple query to get data
1
2
3
4
5
6
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
);
Simple query to get data
1
2
3
4
5
6
7
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
});
Simple query to get data
1
2
3
4
5
6
7
8
9
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
})
if err != nil {
    return nil, err
}
Simple query to get data
1
2
3
4
5
6
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        })),
)?;
Simple query to get data
1
2
3
4
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    )));
Simple query to get data
1
2
3
4
5
6
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        )),
)

query [headers]

query headers
1
2
3
4
5
6
7
8
9
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
query headers
1
2
3
4
5
6
7
8
9
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
query headers
1
2
3
4
5
6
7
8
9
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
query headers
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
query headers
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Headers: am.M{
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
})
if err != nil {
    return nil, err
}
query headers
1
2
3
4
5
6
7
8
9
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
query headers
1
2
3
4
5
6
7
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
query headers
1
2
3
4
5
6
7
8
9
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)

query [select]

query select
1
2
3
4
5
6
7
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    select: "first_name"
});
query select
1
2
3
4
5
6
7
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    select='first_name',
)
query select
1
2
3
4
5
6
7
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    select: 'first_name',
);
query select
1
2
3
4
5
6
7
8
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Select = "first_name",
});
query select
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Select: "first_name",
})
if err != nil {
    return nil, err
}
query select
1
2
3
4
5
6
7
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .select("first_name"),
)?;
query select
1
2
3
4
5
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .select("first_name"));
query select
1
2
3
4
5
6
7
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .select("first_name"),
)

query [limit]

query limit
1
2
3
4
5
6
7
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    limit: 2
});
query limit
1
2
3
4
5
6
7
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    limit=2,
)
query limit
1
2
3
4
5
6
7
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    limit: 2,
);
query limit
1
2
3
4
5
6
7
8
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Limit = 2,
});
query limit
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Limit: 2,
})
if err != nil {
    return nil, err
}
query limit
1
2
3
4
5
6
7
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .limit(2),
)?;
query limit
1
2
3
4
5
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .limit(2));
query limit
1
2
3
4
5
6
7
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .limit(2),
)

query [skip]

query skip
1
2
3
4
5
6
7
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    skip: 1
});
query skip
1
2
3
4
5
6
7
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    skip=1,
)
query skip
1
2
3
4
5
6
7
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    skip: 1,
);
query skip
1
2
3
4
5
6
7
8
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Skip = 1,
});
query skip
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Skip: 1,
})
if err != nil {
    return nil, err
}
query skip
1
2
3
4
5
6
7
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .skip(1),
)?;
query skip
1
2
3
4
5
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .skip(1));
query skip
1
2
3
4
5
6
7
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .skip(1),
)

query [sort]

query sort
1
2
3
4
5
6
7
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    sort: "first_name"
});
query sort
1
2
3
4
5
6
7
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    sort='first_name',
)
query sort
1
2
3
4
5
6
7
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    sort: 'first_name',
);
query sort
1
2
3
4
5
6
7
8
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Sort = "first_name",
});
query sort
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Sort: "first_name",
})
if err != nil {
    return nil, err
}
query sort
1
2
3
4
5
6
7
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .sort("first_name"),
)?;
query sort
1
2
3
4
5
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .sort("first_name"));
query sort
1
2
3
4
5
6
7
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .sort("first_name"),
)

query [deep]

query deep
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find:{
        "first_name": "Bob"
    },
    deep: [
        {
            s_key: "customer_id",
            t_instance: "mysql",
            t_db: "inventory",
            t_col: "products",
            t_key: "owner_id",
        }
    ],
});
query deep
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Bob',
    },
    deep=[
        DeepItem(
            'customer_id',
            t_instance='mysql',
            t_db='inventory',
            t_col='products',
            t_key='owner_id',
        ),
    ],
)
query deep
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    deep: [
        new DeepItem(
            'customer_id',
            tInstance: 'mysql',
            tDb: 'inventory',
            tCol: 'products',
            tKey: 'owner_id',
        ),
    ],
);
query deep
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Deep = new[]
    {
        new DeepItem("customer_id")
        {
            TInstance = "mysql",
            TDb = "inventory",
            TCol = "products",
            TKey = "owner_id",
        },
    },
});
query deep
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Deep: []am.DeepItem{
        {
            SKey:      "customer_id",
            TInstance: "mysql",
            TDb:       "inventory",
            TCol:      "products",
            TKey:      "owner_id",
        },
    },
})
if err != nil {
    return nil, err
}
query deep
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .deep(vec![
            DeepItem::new("customer_id")
                .t_instance("mysql")
                .t_db("inventory")
                .t_col("products")
                .t_key("owner_id"),
        ]),
)?;
query deep
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .deep(List.of(
        new DeepItem("customer_id")
            .tInstance("mysql")
            .tDb("inventory")
            .tCol("products")
            .tKey("owner_id")
    )));
query deep
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .deep(listOf(
            DeepItem("customer_id")
                .tInstance("mysql")
                .tDb("inventory")
                .tCol("products")
                .tKey("owner_id"),
        )),
)

$lt [less than] query

less than query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$lt": 2
        }
    }
});
less than query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$lt': 2,
        },
    },
)
less than query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$lt' => 2,
        ],
    ],
);
less than query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lt"] = 2,
        },
    },
});
less than query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$lt": 2,
        },
    },
})
if err != nil {
    return nil, err
}
less than query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$lt": 2,
            },
        })),
)?;
less than query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$lt", 2
        )
    )));
less than query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lt" to 2,
            ),
        )),
)

$lte [less than equal] query

less than equal query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$lte": 2
        }
    }
});
less than equal query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$lte': 2,
        },
    },
)
less than equal query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$lte' => 2,
        ],
    ],
);
less than equal query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lte"] = 2,
        },
    },
});
less than equal query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$lte": 2,
        },
    },
})
if err != nil {
    return nil, err
}
less than equal query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$lte": 2,
            },
        })),
)?;
less than equal query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$lte", 2
        )
    )));
less than equal query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lte" to 2,
            ),
        )),
)

$gt [greater than] query

greater than query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$gt": 2
        }
    }
});
greater than query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$gt': 2,
        },
    },
)
greater than query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$gt' => 2,
        ],
    ],
);
greater than query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gt"] = 2,
        },
    },
});
greater than query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$gt": 2,
        },
    },
})
if err != nil {
    return nil, err
}
greater than query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$gt": 2,
            },
        })),
)?;
greater than query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$gt", 2
        )
    )));
greater than query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gt" to 2,
            ),
        )),
)

$gte [greater than equal] query

greater than equal query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$gte": 2
        }
    }
});
greater than equal query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$gte': 2,
        },
    },
)
greater than equal query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$gte' => 2,
        ],
    ],
);
greater than equal query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gte"] = 2,
        },
    },
});
greater than equal query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$gte": 2,
        },
    },
})
if err != nil {
    return nil, err
}
greater than equal query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$gte": 2,
            },
        })),
)?;
greater than equal query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$gte", 2
        )
    )));
greater than equal query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gte" to 2,
            ),
        )),
)

$eq [equal to] query

$eq query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$eq": 2
        }
    }
});
$eq query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$eq': 2,
        },
    },
)
$eq query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$eq' => 2,
        ],
    ],
);
$eq query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$eq"] = 2,
        },
    },
});
$eq query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$eq": 2,
        },
    },
})
if err != nil {
    return nil, err
}
$eq query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$eq": 2,
            },
        })),
)?;
$eq query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$eq", 2
        )
    )));
$eq query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$eq" to 2,
            ),
        )),
)

$ne [not equal to] query

$ne query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$ne": 2
        }
    }
});
$ne query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$ne': 2,
        },
    },
)
$ne query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$ne' => 2,
        ],
    ],
);
$ne query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$ne"] = 2,
        },
    },
});
$ne query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$ne": 2,
        },
    },
})
if err != nil {
    return nil, err
}
$ne query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$ne": 2,
            },
        })),
)?;
$ne query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$ne", 2
        )
    )));
$ne query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$ne" to 2,
            ),
        )),
)

$not [not] query

$not query
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        customer_id: {
            "$not": {
                "$in": [1, 2, 3, 4]
            }
        }
    }
});
$not query
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$not': {
                '$in': [1, 2, 3, 4],
            },
        },
    },
)
$not query
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$not' => [
                '$in' => [1, 2, 3, 4],
            ],
        ],
    ],
);
$not query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$not"] = new JsonObject
            {
                ["$in"] = new JsonArray { 1, 2, 3, 4 },
            },
        },
    },
});
$not query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$not": am.M{
                "$in": []any{1, 2, 3, 4},
            },
        },
    },
})
if err != nil {
    return nil, err
}
$not query
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$not": {
                    "$in": [1, 2, 3, 4],
                },
            },
        })),
)?;
$not query
1
2
3
4
5
6
7
8
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$not", Map.of(
                "$in", List.of(1, 2, 3, 4)
            )
        )
    )));
$not query
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$not" to mapOf(
                    "\$in" to listOf(1, 2, 3, 4),
                ),
            ),
        )),
)

$and [and] query

$and query
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$and": [
            {
                "customer_id": 2
            },
            {
                "pincode": 7171
            }
        ]
    }
});
$and query
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$and': [
            {
                'customer_id': 2,
            },
            {
                'pincode': 7171,
            },
        ],
    },
)
$and query
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$and' => [
            [
                'customer_id' => 2,
            ],
            [
                'pincode' => 7171,
            ],
        ],
    ],
);
$and query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$and"] = new JsonArray
        {
            new JsonObject
            {
                ["customer_id"] = 2,
            },
            new JsonObject
            {
                ["pincode"] = 7171,
            },
        },
    },
});
$and query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$and": []any{
            am.M{
                "customer_id": 2,
            },
            am.M{
                "pincode": 7171,
            },
        },
    },
})
if err != nil {
    return nil, err
}
$and query
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$and": [
                {
                    "customer_id": 2,
                },
                {
                    "pincode": 7171,
                },
            ],
        })),
)?;
$and query
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$and", List.of(
            Map.of(
                "customer_id", 2
            ),
            Map.of(
                "pincode", 7171
            )
        )
    )));
$and query
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$and" to listOf(
                mapOf(
                    "customer_id" to 2,
                ),
                mapOf(
                    "pincode" to 7171,
                ),
            ),
        )),
)

Find-join example

find join $and query
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$and": [
            {
                "first_name.customer_id.shipping_id": 2
            },
            {
                "first_name.customer_id.order_id": 58
            }
        ]
    }
});
find join $and query
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$and': [
            {
                'first_name.customer_id.shipping_id': 2,
            },
            {
                'first_name.customer_id.order_id': 58,
            },
        ],
    },
)
find join $and query
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$and' => [
            [
                'first_name.customer_id.shipping_id' => 2,
            ],
            [
                'first_name.customer_id.order_id' => 58,
            ],
        ],
    ],
);
find join $and query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$and"] = new JsonArray
        {
            new JsonObject
            {
                ["first_name.customer_id.shipping_id"] = 2,
            },
            new JsonObject
            {
                ["first_name.customer_id.order_id"] = 58,
            },
        },
    },
});
find join $and query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$and": []any{
            am.M{
                "first_name.customer_id.shipping_id": 2,
            },
            am.M{
                "first_name.customer_id.order_id": 58,
            },
        },
    },
})
if err != nil {
    return nil, err
}
find join $and query
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$and": [
                {
                    "first_name.customer_id.shipping_id": 2,
                },
                {
                    "first_name.customer_id.order_id": 58,
                },
            ],
        })),
)?;
find join $and query
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$and", List.of(
            Map.of(
                "first_name.customer_id.shipping_id", 2
            ),
            Map.of(
                "first_name.customer_id.order_id", 58
            )
        )
    )));
find join $and query
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$and" to listOf(
                mapOf(
                    "first_name.customer_id.shipping_id" to 2,
                ),
                mapOf(
                    "first_name.customer_id.order_id" to 58,
                ),
            ),
        )),
)

$or [or] query

$or query
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$or": [
            {
                "customer_id": 2
            },
            {
                "pincode": 7171
            }
        ]
    }
});
$or query
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$or': [
            {
                'customer_id': 2,
            },
            {
                'pincode': 7171,
            },
        ],
    },
)
$or query
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$or' => [
            [
                'customer_id' => 2,
            ],
            [
                'pincode' => 7171,
            ],
        ],
    ],
);
$or query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$or"] = new JsonArray
        {
            new JsonObject
            {
                ["customer_id"] = 2,
            },
            new JsonObject
            {
                ["pincode"] = 7171,
            },
        },
    },
});
$or query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$or": []any{
            am.M{
                "customer_id": 2,
            },
            am.M{
                "pincode": 7171,
            },
        },
    },
})
if err != nil {
    return nil, err
}
$or query
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$or": [
                {
                    "customer_id": 2,
                },
                {
                    "pincode": 7171,
                },
            ],
        })),
)?;
$or query
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$or", List.of(
            Map.of(
                "customer_id", 2
            ),
            Map.of(
                "pincode", 7171
            )
        )
    )));
$or query
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$or" to listOf(
                mapOf(
                    "customer_id" to 2,
                ),
                mapOf(
                    "pincode" to 7171,
                ),
            ),
        )),
)

Find-join example

find join $or query
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$or": [
            {
                "first_name.customer_id.shipping_id": 2
            },
            {
                "first_name.customer_id.order_id": 58
            }
        ]
    }
});
find join $or query
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$or': [
            {
                'first_name.customer_id.shipping_id': 2,
            },
            {
                'first_name.customer_id.order_id': 58,
            },
        ],
    },
)
find join $or query
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$or' => [
            [
                'first_name.customer_id.shipping_id' => 2,
            ],
            [
                'first_name.customer_id.order_id' => 58,
            ],
        ],
    ],
);
find join $or query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$or"] = new JsonArray
        {
            new JsonObject
            {
                ["first_name.customer_id.shipping_id"] = 2,
            },
            new JsonObject
            {
                ["first_name.customer_id.order_id"] = 58,
            },
        },
    },
});
find join $or query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$or": []any{
            am.M{
                "first_name.customer_id.shipping_id": 2,
            },
            am.M{
                "first_name.customer_id.order_id": 58,
            },
        },
    },
})
if err != nil {
    return nil, err
}
find join $or query
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$or": [
                {
                    "first_name.customer_id.shipping_id": 2,
                },
                {
                    "first_name.customer_id.order_id": 58,
                },
            ],
        })),
)?;
find join $or query
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$or", List.of(
            Map.of(
                "first_name.customer_id.shipping_id", 2
            ),
            Map.of(
                "first_name.customer_id.order_id", 58
            )
        )
    )));
find join $or query
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$or" to listOf(
                mapOf(
                    "first_name.customer_id.shipping_id" to 2,
                ),
                mapOf(
                    "first_name.customer_id.order_id" to 58,
                ),
            ),
        )),
)

$in [in] query

$in query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$in": [1, 2]
        }
    }
});
$in query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$in': [1, 2],
        },
    },
)
$in query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$in' => [1, 2],
        ],
    ],
);
$in query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$in"] = new JsonArray { 1, 2 },
        },
    },
});
$in query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$in": []any{1, 2},
        },
    },
})
if err != nil {
    return nil, err
}
$in query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$in": [1, 2],
            },
        })),
)?;
$in query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$in", List.of(1, 2)
        )
    )));
$in query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$in" to listOf(1, 2),
            ),
        )),
)

$nin [not in] query

$nin query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$nin": [1, 2]
        }
    }
});
$nin query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$nin': [1, 2],
        },
    },
)
$nin query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$nin' => [1, 2],
        ],
    ],
);
$nin query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$nin"] = new JsonArray { 1, 2 },
        },
    },
});
$nin query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "customer_id": am.M{
            "$nin": []any{1, 2},
        },
    },
})
if err != nil {
    return nil, err
}
$nin query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$nin": [1, 2],
            },
        })),
)?;
$nin query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$nin", List.of(1, 2)
        )
    )));
$nin query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$nin" to listOf(1, 2),
            ),
        )),
)

$like [like] query

$like query
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "first_name": {
            "$like": "Bob%"
        }
    }
});
$like query
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': {
            '$like': 'Bob%',
        },
    },
)
$like query
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => [
            '$like' => 'Bob%',
        ],
    ],
);
$like query
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = new JsonObject
        {
            ["$like"] = "Bob%",
        },
    },
});
$like query
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": am.M{
            "$like": "Bob%",
        },
    },
})
if err != nil {
    return nil, err
}
$like query
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": {
                "$like": "Bob%",
            },
        })),
)?;
$like query
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", Map.of(
            "$like", "Bob%"
        )
    )));
$like query
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to mapOf(
                "\$like" to "Bob%",
            ),
        )),
)

$isNull [null check] with sql databases

$isNull use
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "first_name": {
            "$isNull": true
        }
    }
});
$isNull use
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': {
            '$isNull': True,
        },
    },
)
$isNull use
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => [
            '$isNull' => true,
        ],
    ],
);
$isNull use
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = new JsonObject
        {
            ["$isNull"] = true,
        },
    },
});
$isNull use
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "first_name": am.M{
            "$isNull": true,
        },
    },
})
if err != nil {
    return nil, err
}
$isNull use
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": {
                "$isNull": true,
            },
        })),
)?;
$isNull use
1
2
3
4
5
6
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", Map.of(
            "$isNull", true
        )
    )));
$isNull use
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to mapOf(
                "\$isNull" to true,
            ),
        )),
)

MongoDB $in operator in nested find

$in operator in nested find
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "eventListeners.versions.name": {
            "$in": [
                "Original",
                "1"
            ]
        }
    }
});
$in operator in nested find
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'eventListeners.versions.name': {
            '$in': [
                'Original',
                '1',
            ],
        },
    },
)
$in operator in nested find
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'eventListeners.versions.name' => [
            '$in' => [
                'Original',
                '1',
            ],
        ],
    ],
);
$in operator in nested find
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["eventListeners.versions.name"] = new JsonObject
        {
            ["$in"] = new JsonArray
            {
                "Original",
                "1",
            },
        },
    },
});
$in operator in nested find
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "eventListeners.versions.name": am.M{
            "$in": []string{
                "Original",
                "1",
            },
        },
    },
})
if err != nil {
    return nil, err
}
$in operator in nested find
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "eventListeners.versions.name": {
                "$in": [
                    "Original",
                    "1",
                ],
            },
        })),
)?;
$in operator in nested find
1
2
3
4
5
6
7
8
9
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "eventListeners.versions.name", Map.of(
            "$in", List.of(
                "Original",
                "1"
            )
        )
    )));
$in operator in nested find
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "eventListeners.versions.name" to mapOf(
                "\$in" to listOf(
                    "Original",
                    "1",
                ),
            ),
        )),
)

MongoDB $nin operator in nested find

$nin operator in nested find
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "eventListeners.versions.name": {
            "$nin": [
                "Original",
                "1"
            ]
        }
    }
});
$nin operator in nested find
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        'eventListeners.versions.name': {
            '$nin': [
                'Original',
                '1',
            ],
        },
    },
)
$nin operator in nested find
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        'eventListeners.versions.name' => [
            '$nin' => [
                'Original',
                '1',
            ],
        ],
    ],
);
$nin operator in nested find
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["eventListeners.versions.name"] = new JsonObject
        {
            ["$nin"] = new JsonArray
            {
                "Original",
                "1",
            },
        },
    },
});
$nin operator in nested find
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "eventListeners.versions.name": am.M{
            "$nin": []string{
                "Original",
                "1",
            },
        },
    },
})
if err != nil {
    return nil, err
}
$nin operator in nested find
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "eventListeners.versions.name": {
                "$nin": [
                    "Original",
                    "1",
                ],
            },
        })),
)?;
$nin operator in nested find
1
2
3
4
5
6
7
8
9
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "eventListeners.versions.name", Map.of(
            "$nin", List.of(
                "Original",
                "1"
            )
        )
    )));
$nin operator in nested find
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "eventListeners.versions.name" to mapOf(
                "\$nin" to listOf(
                    "Original",
                    "1",
                ),
            ),
        )),
)

MongoDB $and operator in nested find

$and operator in nested find
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$and": [
            {
                "eventListeners.versions.name": "Original"
            },
            {
                "eventListeners.versions.version": "-1"
            }
        ]
    }
});
$and operator in nested find
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$and': [
            {
                'eventListeners.versions.name': 'Original',
            },
            {
                'eventListeners.versions.version': '-1',
            },
        ],
    },
)
$and operator in nested find
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$and' => [
            [
                'eventListeners.versions.name' => 'Original',
            ],
            [
                'eventListeners.versions.version' => '-1',
            ],
        ],
    ],
);
$and operator in nested find
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$and"] = new JsonArray
        {
            new JsonObject
            {
                ["eventListeners.versions.name"] = "Original",
            },
            new JsonObject
            {
                ["eventListeners.versions.version"] = "-1",
            },
        },
    },
});
$and operator in nested find
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$and": []any{
            am.M{
                "eventListeners.versions.name": "Original",
            },
            am.M{
                "eventListeners.versions.version": "-1",
            },
        },
    },
})
if err != nil {
    return nil, err
}
$and operator in nested find
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$and": [
                {
                    "eventListeners.versions.name": "Original",
                },
                {
                    "eventListeners.versions.version": "-1",
                },
            ],
        })),
)?;
$and operator in nested find
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$and", List.of(
            Map.of(
                "eventListeners.versions.name", "Original"
            ),
            Map.of(
                "eventListeners.versions.version", "-1"
            )
        )
    )));
$and operator in nested find
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$and" to listOf(
                mapOf(
                    "eventListeners.versions.name" to "Original",
                ),
                mapOf(
                    "eventListeners.versions.version" to "-1",
                ),
            ),
        )),
)

MongoDB $or operator in nested find

$or operator in nested find
let query = await g.sys.db.query({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "$or": [
            {
                "eventListeners.versions.name": "Original"
            },
            {
                "eventListeners.versions.version": "-1"
            }
        ]
    }
});
$or operator in nested find
query = await g.sys.db.query(
    'mysql_8', 'inventory', 'customers',
    find={
        '$or': [
            {
                'eventListeners.versions.name': 'Original',
            },
            {
                'eventListeners.versions.version': '-1',
            },
        ],
    },
)
$or operator in nested find
$query = $g->sys->db->query(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$or' => [
            [
                'eventListeners.versions.name' => 'Original',
            ],
            [
                'eventListeners.versions.version' => '-1',
            ],
        ],
    ],
);
$or operator in nested find
var query = await g.Sys.Db.Query(new Query("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$or"] = new JsonArray
        {
            new JsonObject
            {
                ["eventListeners.versions.name"] = "Original",
            },
            new JsonObject
            {
                ["eventListeners.versions.version"] = "-1",
            },
        },
    },
});
$or operator in nested find
query, err := g.Sys.Db.Query(am.Query{
    Instance: "mysql_8", Database: "inventory", Collection: "customers",
    Find: am.M{
        "$or": []any{
            am.M{
                "eventListeners.versions.name": "Original",
            },
            am.M{
                "eventListeners.versions.version": "-1",
            },
        },
    },
})
if err != nil {
    return nil, err
}
$or operator in nested find
let query = g.sys.db.query(
    Query::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$or": [
                {
                    "eventListeners.versions.name": "Original",
                },
                {
                    "eventListeners.versions.version": "-1",
                },
            ],
        })),
)?;
$or operator in nested find
var query = g.sys.db.query(new Query("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$or", List.of(
            Map.of(
                "eventListeners.versions.name", "Original"
            ),
            Map.of(
                "eventListeners.versions.version", "-1"
            )
        )
    )));
$or operator in nested find
val query = g.sys.db.query(
    Query("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$or" to listOf(
                mapOf(
                    "eventListeners.versions.name" to "Original",
                ),
                mapOf(
                    "eventListeners.versions.version" to "-1",
                ),
            ),
        )),
)

Structure

query with all params
let query = await g.sys.db.query({
    instance: "INSTANCE_NAME", database: 'DB_NAME', collection: "COLLECTION_NAME",
    find: {
        "COLUMN_NAME": "VALUE"
    },
    limit: 10,
    select: "COMMA_SEPARATED_COLUMN_NAMES",
    deep: [
        {
            s_key: "SOURCE_COLLECTION_COLUMN_NAME",
            t_instance: "TARGET_INSTANCE_NAME",
            t_db: "TARGET_DATABASE_NAME",
            t_col: "TARGET_COLLECTION_NAME",
            t_key: "TARGET_COLLECTION_COLUMN_NAME",
            find: {
                "COLUMN_NAME": "COLUMN_VALUE"
            },
            isMultiple: true,
            limit: 10,
            select: "COMMA_SEPARATED_COLUMN_NAMES",
            skip: 2,
            sort: "COLUMN_NAME",
        }
    ],
    skip: 1,
    sort: "COLUMN_NAME",
    groupBy: "COLUMN_NAME",
    getTotalCount: true,
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type": "make_flat", // no_action | make_flat
        "x-am-meta": "true", // true, false
        "x-am-internationalization": "USER_I18N_ID",
        "x-am-run-in-sandbox": "2",
        "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control": "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout": "13000",
        "x-no-compression": "true", // true | false
        "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization": "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization": "AWS_TOKEN",
        "x-google-authorization": "GOOGLE_TOKEN",
        "x-azure-authorization": "AZURE_TOKEN",
    },
}, true);
query with all params
query = await g.sys.db.full.query(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    find={
        'COLUMN_NAME': 'VALUE',
    },
    limit=10,
    select='COMMA_SEPARATED_COLUMN_NAMES',
    deep=[
        DeepItem(
            'SOURCE_COLLECTION_COLUMN_NAME',
            t_instance='TARGET_INSTANCE_NAME',
            t_db='TARGET_DATABASE_NAME',
            t_col='TARGET_COLLECTION_NAME',
            t_key='TARGET_COLLECTION_COLUMN_NAME',
            find={
                'COLUMN_NAME': 'COLUMN_VALUE',
            },
            is_multiple=True,
            limit=10,
            select='COMMA_SEPARATED_COLUMN_NAMES',
            skip=2,
            sort='COLUMN_NAME',
        ),
    ],
    skip=1,
    sort='COLUMN_NAME',
    group_by='COLUMN_NAME',
    get_total_count=True,
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type': 'make_flat',  # no_action | make_flat
        'x-am-meta': 'true',  # true, false
        'x-am-internationalization': 'USER_I18N_ID',
        'x-am-run-in-sandbox': '2',
        'x-am-content-type-response': 'text/xml',  # application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control': 'reset_cache',  # no_action | reset_cache
        'x-am-get-encrypted-data': 'get_only_encryption',  # no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout': '13000',
        'x-no-compression': 'true',  # true | false
        'x-am-encrypted-payload': 'true',  # user will send 'true', when payload is encrypted for transfer
        # Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username': 'TENANT_USERNAME',  # ex: acme
        # Authorization headers
        'x-am-authorization': 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization': 'API_USER_TOKEN',
        'x-aws-authorization': 'AWS_TOKEN',
        'x-google-authorization': 'GOOGLE_TOKEN',
        'x-azure-authorization': 'AZURE_TOKEN',
    },
)
query with all params
$query = $g->sys->db->full->query(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    find: [
        'COLUMN_NAME' => 'VALUE',
    ],
    limit: 10,
    select: 'COMMA_SEPARATED_COLUMN_NAMES',
    deep: [
        new DeepItem(
            'SOURCE_COLLECTION_COLUMN_NAME',
            tInstance: 'TARGET_INSTANCE_NAME',
            tDb: 'TARGET_DATABASE_NAME',
            tCol: 'TARGET_COLLECTION_NAME',
            tKey: 'TARGET_COLLECTION_COLUMN_NAME',
            find: [
                'COLUMN_NAME' => 'COLUMN_VALUE',
            ],
            isMultiple: true,
            limit: 10,
            select: 'COMMA_SEPARATED_COLUMN_NAMES',
            skip: 2,
            sort: 'COLUMN_NAME',
        ),
    ],
    skip: 1,
    sort: 'COLUMN_NAME',
    groupBy: 'COLUMN_NAME',
    getTotalCount: true,
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type' => 'make_flat', // no_action | make_flat
        'x-am-meta' => 'true', // true, false
        'x-am-internationalization' => 'USER_I18N_ID',
        'x-am-run-in-sandbox' => '2',
        'x-am-content-type-response' => 'text/xml', // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control' => 'reset_cache', // no_action | reset_cache
        'x-am-get-encrypted-data' => 'get_only_encryption', // no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout' => '13000',
        'x-no-compression' => 'true', // true | false
        'x-am-encrypted-payload' => 'true', // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username' => 'TENANT_USERNAME', // ex: acme
        // Authorization headers
        'x-am-authorization' => 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization' => 'API_USER_TOKEN',
        'x-aws-authorization' => 'AWS_TOKEN',
        'x-google-authorization' => 'GOOGLE_TOKEN',
        'x-azure-authorization' => 'AZURE_TOKEN',
    ],
);
query with all params
var query = await g.Sys.Db.Full.Query(new Query("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
{
    Find = new JsonObject
    {
        ["COLUMN_NAME"] = "VALUE",
    },
    Limit = 10,
    Select = "COMMA_SEPARATED_COLUMN_NAMES",
    Deep = new[]
    {
        new DeepItem("SOURCE_COLLECTION_COLUMN_NAME")
        {
            TInstance = "TARGET_INSTANCE_NAME",
            TDb = "TARGET_DATABASE_NAME",
            TCol = "TARGET_COLLECTION_NAME",
            TKey = "TARGET_COLLECTION_COLUMN_NAME",
            Find = new JsonObject
            {
                ["COLUMN_NAME"] = "COLUMN_VALUE",
            },
            IsMultiple = true,
            Limit = 10,
            Select = "COMMA_SEPARATED_COLUMN_NAMES",
            Skip = 2,
            Sort = "COLUMN_NAME",
        },
    },
    Skip = 1,
    Sort = "COLUMN_NAME",
    GroupBy = "COLUMN_NAME",
    GetTotalCount = true,
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        ["x-am-response-object-type"] = "make_flat", // no_action | make_flat
        ["x-am-meta"] = "true", // true, false
        ["x-am-internationalization"] = "USER_I18N_ID",
        ["x-am-run-in-sandbox"] = "2",
        ["x-am-content-type-response"] = "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        ["x-am-cache-control"] = "reset_cache", // no_action | reset_cache
        ["x-am-get-encrypted-data"] = "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        ["x-am-sandbox-timeout"] = "13000",
        ["x-no-compression"] = "true", // true | false
        ["x-am-encrypted-payload"] = "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        ["x-am-tenant-username"] = "TENANT_USERNAME", // ex: acme
        // Authorization headers
        ["x-am-authorization"] = "AUTHORIZATION_TOKEN",
        ["x-am-user-authorization"] = "API_USER_TOKEN",
        ["x-aws-authorization"] = "AWS_TOKEN",
        ["x-google-authorization"] = "GOOGLE_TOKEN",
        ["x-azure-authorization"] = "AZURE_TOKEN",
    },
});
query with all params
query, err := g.Sys.Db.Full.Query(am.Query{
    Instance: "INSTANCE_NAME", Database: "DB_NAME", Collection: "COLLECTION_NAME",
    Find: am.M{
        "COLUMN_NAME": "VALUE",
    },
    Limit:  10,
    Select: "COMMA_SEPARATED_COLUMN_NAMES",
    Deep: []am.DeepItem{
        {
            SKey:      "SOURCE_COLLECTION_COLUMN_NAME",
            TInstance: "TARGET_INSTANCE_NAME",
            TDb:       "TARGET_DATABASE_NAME",
            TCol:      "TARGET_COLLECTION_NAME",
            TKey:      "TARGET_COLLECTION_COLUMN_NAME",
            Find: am.M{
                "COLUMN_NAME": "COLUMN_VALUE",
            },
            IsMultiple: true,
            Limit:      10,
            Select:     "COMMA_SEPARATED_COLUMN_NAMES",
            Skip:       2,
            Sort:       "COLUMN_NAME",
        },
    },
    Skip:          1,
    Sort:          "COLUMN_NAME",
    GroupBy:       "COLUMN_NAME",
    GetTotalCount: true,
    Headers: am.M{
        "x-am-response-case":         "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type":  "make_flat",   // no_action | make_flat
        "x-am-meta":                  "true",        // true, false
        "x-am-internationalization":  "USER_I18N_ID",
        "x-am-run-in-sandbox":        "2",
        "x-am-content-type-response": "text/xml",            // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control":         "reset_cache",         // no_action | reset_cache
        "x-am-get-encrypted-data":    "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout":       "13000",
        "x-no-compression":           "true", // true | false
        "x-am-encrypted-payload":     "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization":      "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization":     "AWS_TOKEN",
        "x-google-authorization":  "GOOGLE_TOKEN",
        "x-azure-authorization":   "AZURE_TOKEN",
    },
})
if err != nil {
    return nil, err
}
query with all params
let query = g.sys.db.full.query(
    Query::new("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
        .find(json!({
            "COLUMN_NAME": "VALUE",
        }))
        .limit(10)
        .select("COMMA_SEPARATED_COLUMN_NAMES")
        .deep(vec![
            DeepItem::new("SOURCE_COLLECTION_COLUMN_NAME")
                .t_instance("TARGET_INSTANCE_NAME")
                .t_db("TARGET_DATABASE_NAME")
                .t_col("TARGET_COLLECTION_NAME")
                .t_key("TARGET_COLLECTION_COLUMN_NAME")
                .find(json!({
                    "COLUMN_NAME": "COLUMN_VALUE",
                }))
                .is_multiple(true)
                .limit(10)
                .select("COMMA_SEPARATED_COLUMN_NAMES")
                .skip(2)
                .sort("COLUMN_NAME"),
        ])
        .skip(1)
        .sort("COLUMN_NAME")
        .group_by("COLUMN_NAME")
        .get_total_count(true)
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type": "make_flat", // no_action | make_flat
            "x-am-meta": "true", // true, false
            "x-am-internationalization": "USER_I18N_ID",
            "x-am-run-in-sandbox": "2",
            "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control": "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout": "13000",
            "x-no-compression": "true", // true | false
            "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization": "AUTHORIZATION_TOKEN",
            "x-am-user-authorization": "API_USER_TOKEN",
            "x-aws-authorization": "AWS_TOKEN",
            "x-google-authorization": "GOOGLE_TOKEN",
            "x-azure-authorization": "AZURE_TOKEN",
        })),
)?;
query with all params
var query = g.sys.db.full.query(new Query("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
    .find(Map.of(
        "COLUMN_NAME", "VALUE"
    ))
    .limit(10)
    .select("COMMA_SEPARATED_COLUMN_NAMES")
    .deep(List.of(
        new DeepItem("SOURCE_COLLECTION_COLUMN_NAME")
            .tInstance("TARGET_INSTANCE_NAME")
            .tDb("TARGET_DATABASE_NAME")
            .tCol("TARGET_COLLECTION_NAME")
            .tKey("TARGET_COLLECTION_COLUMN_NAME")
            .find(Map.of(
                "COLUMN_NAME", "COLUMN_VALUE"
            ))
            .isMultiple(true)
            .limit(10)
            .select("COMMA_SEPARATED_COLUMN_NAMES")
            .skip(2)
            .sort("COLUMN_NAME")
    ))
    .skip(1)
    .sort("COLUMN_NAME")
    .groupBy("COLUMN_NAME")
    .getTotalCount(true)
    .headers(JsonObject.of(
        "x-am-response-case", "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type", "make_flat", // no_action | make_flat
        "x-am-meta", "true", // true, false
        "x-am-internationalization", "USER_I18N_ID",
        "x-am-run-in-sandbox", "2",
        "x-am-content-type-response", "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control", "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data", "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout", "13000",
        "x-no-compression", "true", // true | false
        "x-am-encrypted-payload", "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username", "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization", "AUTHORIZATION_TOKEN",
        "x-am-user-authorization", "API_USER_TOKEN",
        "x-aws-authorization", "AWS_TOKEN",
        "x-google-authorization", "GOOGLE_TOKEN",
        "x-azure-authorization", "AZURE_TOKEN"
    )));
query with all params
val query = g.sys.db.full.query(
    Query("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
        .find(mapOf(
            "COLUMN_NAME" to "VALUE",
        ))
        .limit(10)
        .select("COMMA_SEPARATED_COLUMN_NAMES")
        .deep(listOf(
            DeepItem("SOURCE_COLLECTION_COLUMN_NAME")
                .tInstance("TARGET_INSTANCE_NAME")
                .tDb("TARGET_DATABASE_NAME")
                .tCol("TARGET_COLLECTION_NAME")
                .tKey("TARGET_COLLECTION_COLUMN_NAME")
                .find(mapOf(
                    "COLUMN_NAME" to "COLUMN_VALUE",
                ))
                .isMultiple(true)
                .limit(10)
                .select("COMMA_SEPARATED_COLUMN_NAMES")
                .skip(2)
                .sort("COLUMN_NAME"),
        ))
        .skip(1)
        .sort("COLUMN_NAME")
        .groupBy("COLUMN_NAME")
        .getTotalCount(true)
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type" to "make_flat", // no_action | make_flat
            "x-am-meta" to "true", // true, false
            "x-am-internationalization" to "USER_I18N_ID",
            "x-am-run-in-sandbox" to "2",
            "x-am-content-type-response" to "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control" to "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data" to "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout" to "13000",
            "x-no-compression" to "true", // true | false
            "x-am-encrypted-payload" to "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username" to "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization" to "AUTHORIZATION_TOKEN",
            "x-am-user-authorization" to "API_USER_TOKEN",
            "x-aws-authorization" to "AWS_TOKEN",
            "x-google-authorization" to "GOOGLE_TOKEN",
            "x-azure-authorization" to "AZURE_TOKEN",
        )),
)

Multi-tenant

  • instance: "crm::acme" works on the database of the tenant acme of the multi-tenant instance crm.
  • With instance: "crm", the call works on the database of the tenant of the request: a custom API called with the x-am-tenant-username header passes it on to the APIs it calls. A request without a tenant works on the structure database.
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
let query = await g.sys.db.query({
    instance: "crm::acme", database: "crm", collection: "customers",
    find: {
        "first_name": "Bob"
    },
    sort: "customer_id",
    limit: 10
});
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
query = await g.sys.db.query(
    'crm::acme', 'crm', 'customers',
    find={
        'first_name': 'Bob',
    },
    sort='customer_id',
    limit=10,
)
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
$query = $g->sys->db->query(
    'crm::acme', 'crm', 'customers',
    find: [
        'first_name' => 'Bob',
    ],
    sort: 'customer_id',
    limit: 10,
);
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
9
var query = await g.Sys.Db.Query(new Query("crm::acme", "crm", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Bob",
    },
    Sort = "customer_id",
    Limit = 10,
});
Query the customers of the tenant acme
query, err := g.Sys.Db.Query(am.Query{
    Instance: "crm::acme", Database: "crm", Collection: "customers",
    Find: am.M{
        "first_name": "Bob",
    },
    Sort:  "customer_id",
    Limit: 10,
})
if err != nil {
    return nil, err
}
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
let query = g.sys.db.query(
    Query::new("crm::acme", "crm", "customers")
        .find(json!({
            "first_name": "Bob",
        }))
        .sort("customer_id")
        .limit(10),
)?;
Query the customers of the tenant acme
1
2
3
4
5
6
var query = g.sys.db.query(new Query("crm::acme", "crm", "customers")
    .find(Map.of(
        "first_name", "Bob"
    ))
    .sort("customer_id")
    .limit(10));
Query the customers of the tenant acme
1
2
3
4
5
6
7
8
val query = g.sys.db.query(
    Query("crm::acme", "crm", "customers")
        .find(mapOf(
            "first_name" to "Bob",
        ))
        .sort("customer_id")
        .limit(10),
)

Without a schema

g.sys.db.gen.queryGen takes the same arguments and calls the query for get data generated API : no schema, so the data is read and written as it is in the table, without the conversions, validations and defaults of the schema.

Language The call
TypeScript g.sys.db.gen.queryGen(…)
Python g.sys.db.gen.query_gen(…)
PHP $g->sys->db->gen->queryGen(…)
C#, Go g.Sys.Db.Gen.QueryGen(…)
Rust g.sys.db.query_gen(Query::new(…))
Java, Kotlin g.sys.db.gen.queryGen(…)