mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Add Model.createCollection() (#34193)
This commit is contained in:
Vendored
+6
@@ -2989,6 +2989,12 @@ declare module "mongoose" {
|
||||
create(...docs: any[]): Promise<T>;
|
||||
create(...docsWithCallback: any[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Create the collection for this model. By default, if no indexes are specified, mongoose will not create the
|
||||
* collection for the model until any documents are created. Use this method to create the collection explicitly.
|
||||
*/
|
||||
createCollection(options?: mongodb.CollectionCreateOptions, cb?: (err: any) => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* Adds a discriminator type.
|
||||
* @param name discriminator model name
|
||||
|
||||
@@ -1648,6 +1648,9 @@ MongoModel.create([{ type: 'jelly bean' }, {
|
||||
arg[0].save();
|
||||
arg[1].save();
|
||||
});
|
||||
MongoModel.createCollection().then(() => {});
|
||||
MongoModel.createCollection({ capped: true, max: 42 }).then(() => {});
|
||||
MongoModel.createCollection({ capped: true, max: 42 }, err => {});
|
||||
MongoModel.distinct('url', { clicks: {$gt: 100}}, function (err, result) {
|
||||
});
|
||||
MongoModel.distinct('url').exec(cb);
|
||||
|
||||
Reference in New Issue
Block a user