MCPcopy
hub / github.com/eveningkid/denodb / count

Method count

lib/model.ts:780–789  ·  view source on GitHub ↗

Count the number of records of a model or filtered by a field name. * * await Flight.count(); * * await Flight.where("destination", "Dublin").count();

(field = "*")

Source from the content-addressed store, hash-verified

778 * await Flight.where("destination", "Dublin").count();
779 */
780 static async count(field = "*") {
781 const value = await this._runQuery(
782 this._currentQuery
783 .table(this.table)
784 .count(this.formatFieldToDatabase(field) as string)
785 .toDescription(),
786 );
787
788 return Number((value as AggregationResult[])[0].count);
789 }
790
791 /** Find the minimum value of a field from all the selected records.
792 *

Callers 3

translateToQueryMethod · 0.45
queryMethod · 0.45
response.test.tsFile · 0.45

Calls 4

_runQueryMethod · 0.95
formatFieldToDatabaseMethod · 0.95
toDescriptionMethod · 0.80
tableMethod · 0.80

Tested by

no test coverage detected