mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #12533 from ArthurHoaro/types-countDocuments
Add TS types for Mongo Collection countDocuments and estimatedDocumentCount
This commit is contained in:
@@ -339,7 +339,6 @@ Object.assign(Mongo.Collection.prototype, {
|
||||
* @method estimatedDocumentCount
|
||||
* @memberof Mongo.Collection
|
||||
* @instance
|
||||
* @param {MongoSelector} [selector] A query describing the documents to count
|
||||
* @param {Object} [options] All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/EstimatedDocumentCountOptions.html). Please note that not all of them are available on the client.
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
|
||||
11
packages/mongo/mongo.d.ts
vendored
11
packages/mongo/mongo.d.ts
vendored
@@ -171,6 +171,17 @@ export namespace Mongo {
|
||||
selector?: Selector<T> | ObjectID | string,
|
||||
options?: O
|
||||
): Promise<DispatchTransform<O['transform'], T, U> | undefined>;
|
||||
/**
|
||||
* Gets the number of documents matching the filter. For a fast count of the total documents in a collection see `estimatedDocumentCount`.
|
||||
* @param selector The query for filtering the set of documents to count
|
||||
* @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client.
|
||||
*/
|
||||
countDocuments(selector?: Selector<T> | ObjectID | string, options?: MongoNpmModule.CountDocumentsOptions): Promise<number>;
|
||||
/**
|
||||
* Gets an estimate of the count of documents in a collection using collection metadata. For an exact count of the documents in a collection see `countDocuments`.
|
||||
* @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client.
|
||||
*/
|
||||
estimatedDocumentCount(options?: MongoNpmModule.EstimatedDocumentCountOptions): Promise<number>;
|
||||
/**
|
||||
* Insert a document in the collection. Returns its unique _id.
|
||||
* @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you.
|
||||
|
||||
Reference in New Issue
Block a user