I'm still new to mysql and backend overall so i'm sorry if it's a dumb question.
I am using node/mysql2 to access mysql DB. Promisified connection pool method is used for connection. When i try this code:
const result = await db.query(
`
SELECT
id
FROM
User
WHERE
name = ?
`,
[name]
);
return result[0];
the return value is this array
[ [ TextRow { id: 53 } ], [ ColumnDefinition { _buf: <Buffer 01 00 00 01 01 28 00 00 02 03 64 65 66 06 64 65 76 69 6c 7a 04 55 73 65 72 04 55 73 65 72 02 69 64 02 69 64 0c 3f 00 0b 00 00 00 03 0b 42 00 00 00 05 ... 24 more bytes>, _clientEncoding: 'utf8', _catalogLength: 3, _catalogStart: 10, _schemaLength: 6, _schemaStart: 14, _tableLength: 4, _tableStart: 21, _orgTableLength: 4, _orgTableStart: 26, _orgNameLength: 2, _orgNameStart: 34, characterSet: 63, encoding: 'binary', name: 'id', columnLength: 11, columnType: 3, flags: 16907, decimals: 0 } ] ]
but in fact it is an object. Because console.log('result is ', typeof result) shows me an object.
This is the first thing that is confusing me. Why does console.log shows an object type but its return value is an array?
Another thing is that when i try to access TextRow i simply can't. What is TextRow here doing? This also confuses me a lot. If anyone could help clarify this to me i would have appreciated very much
EDIT: added a screenshot of result for better reading
