UNPKG

1.84 kBTypeScriptView Raw
1/**
2 * This file is part of the @egodigital/egoose distribution.
3 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
4 *
5 * @egodigital/egoose is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation, version 3.
8 *
9 * @egodigital/egoose is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17import { MongoDatabase } from '../mongo';
18import { StatisticProviderBase } from '../statistics';
19import * as mongoose from 'mongoose';
20/**
21 * A basic statistic provider that loads data from Mongo database.
22 */
23export declare abstract class MongoDatabaseStatisticProviderBase<TDatabase extends MongoDatabase = MongoDatabase> extends StatisticProviderBase {
24 readonly database: TDatabase;
25 /**
26 * Initializes a new instance of that class.
27 *
28 * @param {TDatabase} database The underlying database connection.
29 */
30 constructor(database: TDatabase);
31 /** @inheritdoc */
32 close(): Promise<void>;
33 /**
34 * Counts all documents of a collection.
35 *
36 * @param {Function} modelSelector The function that returns the model to use.
37 * @param {any} [filter] The optional filter.
38 *
39 * @return {Promise<number>} The promise that contains the number of documents.
40 */
41 protected countDocuments<TDocument extends mongoose.Document>(modelSelector: (db: TDatabase) => mongoose.Model<TDocument>, filter?: any): Promise<number>;
42}
43
\No newline at end of file