2

我正在记录某些查询的结果,它工作正常,但我注意到也记录了太多元数据,如何禁用这些元数据登录?

截屏

    const pool = mariadb.createPool({
        host: 'localhost',
        port: 3306,
        user: 'example',
        password: 'pass',
        waitForConnections: true,
        connectionLimit: 10
    });

    async function asyncFunction () {
        let conn;
        try {
            conn = await pool.getConnection();
            const queryResult = await conn.query('select * from test.sb__user where id=94');
            console.log(queryResult); // [ {val: 1}, meta: ... ]
        } catch (err) {
            throw err;
        } finally {
            if (conn) return conn.end();
        }
    }
4

1 回答 1

0

使用 lodash 从 queryResult 数组中排除元值:

_.difference(queryResult, ['meta'])
于 2021-08-23T04:29:15.353 回答