當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mongoose.disconnect函數代碼示例

本文整理匯總了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();
 });
開發者ID:sjohnsonaz,項目名稱:build-launchpad,代碼行數:8,代碼來源:CreateAdmin.ts

示例2: Promise

 return new Promise((ok, fail) => {
     mongoose.disconnect((e => {
         if (e) {
             fail(e);
         } else {
             ok(true);
         }
     }));
 });
開發者ID:GauSim,項目名稱:node-api-mongo-docker,代碼行數:9,代碼來源:database.ts

示例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");
        });
    }
開發者ID:nshahm,項目名稱:generator-microservice-template,代碼行數:20,代碼來源:Mongodb.ts

示例4: disconnect

function disconnect() {
    mongoose.disconnect();
}
開發者ID:acrobat888,項目名稱:NodeJS,代碼行數:3,代碼來源:testdb.ts

示例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;
開發者ID:RaySingerNZ,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:mongoose-tests.ts

示例6: stop

 public stop(): void {
   this.server.close();
   mongoose.disconnect();
 }
開發者ID:guedjm,項目名稱:StickItWebServer,代碼行數:4,代碼來源:StickItServer.ts

示例7: done

 close: (done) => {
     mongoose.disconnect(err=> {
         done(err)
     });
 },
開發者ID:cm0s,項目名稱:mea2n,代碼行數:5,代碼來源:mongoose_conf.ts

示例8: function

export var disconnect = function() {
  mongoose.disconnect();
};
開發者ID:MisterTea,項目名稱:TidalWave,代碼行數:3,代碼來源:mongoose-handler.ts

示例9: mongoDisconnect

export function mongoDisconnect() {
  mongoose.disconnect(function (err) {
    console.log(chalk.default.bold.yellow('Disconnected from MongoDB.'));
  });
};
開發者ID:projectSHAI,項目名稱:expressgular2,代碼行數:5,代碼來源:index.ts

示例10: disconnect

 disconnect() {
     mongoose.disconnect();
 }
開發者ID:najor,項目名稱:ng2-md-arcgis,代碼行數:3,代碼來源:databaseService.ts


注:本文中的mongoose.disconnect函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。