Skip to content

Save single/multiple

Structure

Save single/multiple structure
1
2
3
4
5
6
7
8
9
let saveSingleOrMultiple = await g.sys.db.gen.saveSingleOrMultipleGen({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    saveData: {
        "field1": "fieldValue1",
        "field2": "fieldValue2"
    }
});

Save single or multiple

Save single/multiple
1
2
3
4
5
6
7
8
9
let saveSingleOrMultiple = await g.sys.db.gen.saveSingleOrMultipleGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    }
});

Save single or multiple with multiple data

Save single/multiple
let saveSingleOrMultiple = await g.sys.db.gen.saveSingleOrMultipleGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: [{
        "first_name": "Bob",
        "last_name": "Lin"
    },
    {
        "first_name": "Alice",
        "last_name": "Page"
    }]
});

with header

Save single/multiple with header
let saveSingleOrMultiple = await g.sys.db.gen.saveSingleOrMultipleGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: {
        "first_name": "Bob",
        "last_name": "Lin"
    },
    headers: {
        "x-am-response-case": "capitalCase"
    }
});