After the database query, the fields of the table are removed, leaving only the data.

after MySQL looks up data, for example, the following data is returned after executing a lookup statement:
RowDataPacket {

ID: 1,
issue: "704929",
userName: "",
group: "",
oper: "",
num: "6",
score: "50",
time: 2018-09-20T09:56:39.000Z,
bonusFlag: 0,
bonusScore: "0",
flag: 0 } 

what should I do if I want to remove the field name and keep only the data? The fields are removed as follows:
RowDataPacket {

 1,
 "704929",
 "",
 "",
 "",
 "6",
 "50",
 2018-09-20T09:56:39.000Z,
 0,
"0",
 0 } 
 
 
Aug.11,2021

if so, it seems that the data without the field name can only be an array:

//js:
let RowDataPacket = {
            ID: 1,
            issue: '704929',
            userName: '',
            group: '',
            oper: '',
            num: '6',
            score: '50',
            time: '2018-09-20T09:56:39.000Z',
            bonusFlag: 0,
            bonusScore: '0',
            flag: 0 } 

//js
var objArr = [];
Object.keys(RowDataPacket).forEach(function(key){
    objArr.push(RowDataPacket[key]);
});
console.log(":",objArr);

:
objArr = [ 1,'704929','','','','6','50','2018-09-20T09:56:39.000Z',0,'0',0]
:Object.values();
objArr = Object.values();

query results (obj) just take the val out

object is in the form of key:val you have a problem with the above request result

Menu