为什么 Knex.js return max('value') 作为数组?
Why does Knex.js return max('value') as an array?
我想从 table:
中找到最大值
knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value');
它 returns 所需的值作为具有单个元素的数组:
[{最大:1000}]
为什么它 return 是一个数组,而不只是一个数字或一个对象?
knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value')
.first(); // Add this to get an object
我想从 table:
中找到最大值knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value');
它 returns 所需的值作为具有单个元素的数组: [{最大:1000}]
为什么它 return 是一个数组,而不只是一个数字或一个对象?
knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value')
.first(); // Add this to get an object