Merge pull request #26057 from ethanresnick/mongoose-connection-patch

feat(mongoose): Document Connection.then/catch
This commit is contained in:
Daniel Rosenwasser
2018-05-27 01:24:46 -07:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@@ -433,7 +433,7 @@ declare module "mongoose" {
$format(arg: any): string;
/** Debug print helper */
$print(name: any, i: any, args: any[]): void;
/** Retreives information about this collections indexes. */
/** Retrieves information about this collections indexes. */
getIndexes(): any;
}
@@ -451,6 +451,9 @@ declare module "mongoose" {
/** Expose the possible connection states. */
static STATES: any;
then: Promise<Connection>["then"];
catch: Promise<Connection>["catch"];
}
/*

View File

@@ -37,6 +37,11 @@ const connection3: null = mongoose.connect(connectUri, function (error) {
var mongooseConnection: mongoose.Connection = mongoose.createConnection();
mongooseConnection.dropDatabase().then(()=>{});
mongooseConnection.dropCollection('foo').then(()=>{});
mongoose.createConnection(connectUri).then((conn)=> {
return conn.collections;
}, () => {
});
mongoose.createConnection(connectUri).open('');
mongoose.createConnection(connectUri, {
db: {