Skip to content

Remove by id

Structure

Remove by id
1
2
3
4
5
6
7
8
let removeById = await g.sys.db.gen.removeByIdGen({
    instance: "INSTANCE_NAME",
    database: "DATABASE_NAME",
    collection: "COLLECTION_NAME",
    select: "COLUMN_NAMES",
    id: 7878,
    primaryKey: "COLUMN_NAME"
});

Simple removeById

Remove By Id
1
2
3
4
5
6
7
8
9
let updateById = await g.sys.db.gen.removeByIdGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    id: 1,
    updateData: {
        "first_name": "MALLORY"
    }
});

removeById primaryKey override

Remove By Id primarykey override
let updateById = await g.sys.db.gen.removeByIdGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    id: "Bob",
    primaryKey: "first_name",    
    updateData: {
        "first_name": "MALLORY"
    }
});

removeById [header]

Remove By Id header
let updateById = await g.sys.db.gen.removeByIdGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    id: "Bob",
    primaryKey: "first_name",    
    updateData: {
        "first_name": "MALLORY"
    },
    headers: {
        "x-am-response-case": "capitalCase"
    }
});

removeById [select]

Remove By Id header
let updateById = await g.sys.db.gen.removeByIdGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    id: "Bob",
    primaryKey: "first_name",    
    updateData: {
        "first_name": "MALLORY"
    },
    select: "first_name,last_name"
});