mysqljs / mysql

A pure node.js JavaScript Client implementing the MySQL protocol.
MIT License
18.22k stars 2.53k forks source link

Two column table returning object? #2475

Closed pedroivorbgrodrigues closed 3 years ago

pedroivorbgrodrigues commented 3 years ago

I don't know if this is intended but when I query all records from a table that has only two columns it returns and object with the first column been the key and the second the value. How can I make it so it return the it like the other tables.

Like this: { "1": "type/Padrão", "2": "Diferenciado", ... }

Instead of this:

{ ["id": 1, "name": "type/Padrão",] ["id": 2 , "name": "Diferenciado"], ... }

pedroivorbgrodrigues commented 3 years ago

Nevermind It was my fault, I did the same method twice and one of them was doing a reduce.