本文整理汇总了TypeScript中mongoose.disconnect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript disconnect函数的具体用法?TypeScript disconnect怎么用?TypeScript disconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disconnect函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
user.save(function(err, user) {
if (err) {
console.error(err);
} else {
console.log(user);
}
mongoose.disconnect();
});
示例2: Promise
return new Promise((ok, fail) => {
mongoose.disconnect((e => {
if (e) {
fail(e);
} else {
ok(true);
}
}));
});
示例3: disconnect
/**
* Mongodb disconnect
*/
public disconnect(): void {
Mongoose.disconnect((err) => {
Logger.info(err);
});
// Mongoose.connection.close(function() {
// Logger.info("Mongoose connection disconnected");
// callback();
// // process.exit(0);
// });
/** When the connection is disconnected */
Mongoose.connection.on("disconnected", function() {
Logger.info("Mongoose default connection disconnected");
});
}
示例4: disconnect
function disconnect() {
mongoose.disconnect();
}
示例5: function
});
var mongooseConnection: mongoose.Connection = mongoose.createConnection();
mongoose.createConnection(connectUri).open('');
mongoose.createConnection(connectUri, {
db: {
native_parser: true
}
}).open('');
mongoose.createConnection('localhost', 'database', 3000).open('');
mongoose.createConnection('localhost', 'database', 3000, {
user: 'larry',
config: {
autoIndex: false
}
}).open('');
mongoose.disconnect(cb).then(cb).fulfill;
mongoose.get('test');
mongoose.model('Actor', new mongoose.Schema({
name: String
}), 'collectionName', true).find({});
mongoose.model('Actor').find({});
mongoose.modelNames()[0].toLowerCase();
new (new mongoose.Mongoose()).Mongoose().connect('');
mongoose.plugin(cb, {}).connect('');
mongoose.set('test', 'value');
mongoose.set('debug', function(collectionName: any, methodName: any, arg1: any, arg2: any) {});
mongoose.STATES.hasOwnProperty('');
mongoose.connection.on('error', cb);
new mongoose.mongo.MongoError('error').stack;
mongoose.SchemaTypes.String;
mongoose.Types.ObjectId;
示例6: stop
public stop(): void {
this.server.close();
mongoose.disconnect();
}
示例7: done
close: (done) => {
mongoose.disconnect(err=> {
done(err)
});
},
示例8: function
export var disconnect = function() {
mongoose.disconnect();
};
示例9: mongoDisconnect
export function mongoDisconnect() {
mongoose.disconnect(function (err) {
console.log(chalk.default.bold.yellow('Disconnected from MongoDB.'));
});
};
示例10: disconnect
disconnect() {
mongoose.disconnect();
}