Skip to content

Master save/update single/multiple

Structure

Master save
1
2
3
4
5
6
7
8
9
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    saveData: {
        first_name: "James",
        last_name: "Bond"
    }
});

master save single data

Master save
1
2
3
4
5
6
7
8
9
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    }
});

master save multiple data

Master save
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: [
        {
            "first_name": "Bob",
            "last_name": "Lin"
        },
        {
            "first_name": "Bob",
            "last_name": "Lin"
        }
    ]
});

with header

Master save with header
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    },
    headers: {
        "x-am-response-case": "capitalCase"
    }
});

multiple database entry

Master save with multy data[with help of schema configuration]
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: {
        "city_name": "Wembley", //city_name save in mysql database
        "state_id": {
            "state_name": "London", //state_name save in maria database
            "country_id": {
                "country_name":"UK" //country_name save in postGreSql database
            }
        }
    },
    headers: {
        "x-am-response-case": "capitalCase"
    }
});

multiple database multiple entry entry

Master save with multy data[with help of schema configuration]
let masterSave = await g.sys.db.gen.masterSaveGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: [{
        "city_name": "Wembley",
        "state_id": {
            "state_name": "London",
            "country_id": 302
        }
    },
    {
        "city_name": "Buffalo",
        "state_id": {
            "state_name": "Chicago",
            "country_id": 303
        }
    }],
    headers: {
        "x-am-response-case": "capitalCase"
    }
});