Skip to content

Get all by stream

Structure

Get all by stream
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    queryParams: {
        deep: `[{
            s_key: "SOURCE_COLLECTION_COLUMN_NAME",
            t_key: "TARGET_COLLECTION_COLUMN_NAME",
            t_col: "TARGET_COLLECTION_NAME",
            select: "COLUMN_NAMES"  
        }]`,
        select: "COLUMN_NAMES",
        sort: "-COLUMN_NAME",
        limit: 2,
        find: `{"price": 42187}`,
        skip: 1,
    }
}, (item) => {
    response.push(item);
});

Simple Get all

Simple Get all from table
1
2
3
4
5
6
7
8
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
}, (item) => {
    response.push(item);
});

With header

Get all with header
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    headers: {
        "x-am-response-case": "capitalCase"
    }
}, (item) => {
    response.push(item);
});

With header and queryParams

Get all with header and queryParams
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    headers: {
        "x-am-response-case": "capitalCase"
    },
    queryParams: {
        select: "first_name,last_name"
    }
}, (item) => {
    response.push(item);
});

With multiple queryParams

Get all With multiple queryParams
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    headers: {
        "x-am-response-case": "capitalCase"
    },
    queryParams: {
        select: "first_name,last_name",
        limit: 2
    }
}, (item) => {
    response.push(item);
});

With all params

Get all With all params
let response = [];
await g.sys.db.gen.getAllByStreamGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    headers: {
        "x-am-response-case": "capitalCase"
    },
    queryParams: {
        select: "first_name,last_name",
        limit: 1,
        sort: "customer_id",
    }
}, (item) => {
    response.push(item);
});