mariadb-corporation / mariadb-connector-nodejs

MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.
GNU Lesser General Public License v2.1
368 stars 91 forks source link

Return of SELECT #175

Closed riccardomerlo closed 2 years ago

riccardomerlo commented 2 years ago

Hello, How can I retrieve only the rows from a SELECT query, instead of getting both single rows and META ? Even deconstructing the result object does not work. Thank you

johnrijoy commented 2 years ago

how did you do it?

riccardomerlo commented 2 years ago

in the end it worked without doing anything...

this is my service:

const result = await this.connection.query(queryString);

if (result.length === 0) {
  return null;
}
return result; 

this is where i call it:

const obj = await this.dbService.get();

if (obj) {
     const res = obj[0]
} 

and res contains just my data, what happened I think was due some console log or something