当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript connection.close方法代码示例

本文整理汇总了TypeScript中mongoose.connection.close方法的典型用法代码示例。如果您正苦于以下问题:TypeScript connection.close方法的具体用法?TypeScript connection.close怎么用?TypeScript connection.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mongoose.connection的用法示例。


在下文中一共展示了connection.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

process.on('SIGINT', function () {/////this function will run jst before app is closing
    console.log("app is terminating");
    mongoose.connection.close(function () {
        console.log('Mongoose default connection closed');
        process.exit(0);
    });
});
开发者ID:MUMARA,项目名称:UmrSalesmenAppLogoutCompleteNoConsoles3,代码行数:7,代码来源:index.ts

示例2: after

after((done) => {
  // required because https://github.com/Automattic/mongoose/issues/1251#issuecomment-65793092
  mongoose.models = {};
  mongoose.modelSchemas = {};
  mongoose.connection.close();
  done();
});
开发者ID:eastmaels,项目名称:v2.api.utopian.io,代码行数:7,代码来源:user.test.ts

示例3: getCheckins

/**
 * //connect into mongoose to get checkins datas got it from previous step
 * @param conds Array
 * @param context Azure function of variable
 */
async function getCheckins (conds, context) {
    mongoose.connect(process.env.MONGOLAB_URI, configs.mongoose);
    const entities = await mongoose.model('Reservation')
        .find({ $or: conds },{checkins: true, payment_no: true, seat_code: true, performance_day: true}).exec()
        .then(docs => docs.map( doc => {
            
            doc.entry_flg = 'FALSE';
            doc.entry_date = null;

            if (doc.checkins.length >= 1) {
                doc.entry_flg = 'TRUE';
                doc.entry_date = doc.checkins[0].when.toISOString();
            }

            return '(' + [
                `'${doc.payment_no}'`
                , `'${doc.seat_code}'`
                , `'${doc.performance_day}'`
                , `'${doc.entry_flg}'`
                , doc.entry_date !== null ? `'${doc.entry_date}'` : `NULL`].join(',') + ')';
        }));

    mongoose.connection.close();
    return entities;
}
开发者ID:motionpicture,项目名称:ttts-functions,代码行数:30,代码来源:index.ts

示例4: async

module.exports = async (context, myBlob) => {
//export async function run (context, myBlob) {

    context.funcId = context.executionContext.invocationId;
    context.log(`ProcessId: ${context.funcId}`);

    try {
        mongoose.connect(process.env.MONGOLAB_URI, configs.mongoose);
        const rows: any = await readCsv(context);
        const entities  = await posRepo.getPosSales(rows);

        const errors = await posRepo.validation(entities, context);
        context.log(`${context.bindingData.name}ファイル: Number of lines appears error is ${errors.length}`);

        if (errors.length == 0) {
            const reservations = await getCheckins(entities, context);
            await posRepo.setCheckins(entities, reservations).then(async (docs) => {
                
                await posRepo.saveToPosSales(docs, context).then(async () => {
                    await posRepo.mergeFunc(context);
                });
            });
        } else {
            Logs.writeErrorLog(context, errors.join("\n"));
        }
        mongoose.connection.close();
    } catch (error) {
        context.log(error);
        Logs.writeErrorLog(context, `${context.bindingData.name}ファイル` + "\n" + error.stack);
    }
}
开发者ID:motionpicture,项目名称:ttts-functions,代码行数:31,代码来源:index.ts

示例5: after

 after(done => {
   mongoose.connection.collections['users'].drop();
   mongoose.connection.close();
   done();
 });
开发者ID:sbelalex,项目名称:nem-ico-project,代码行数:5,代码来源:user.service.spec.ts

示例6: closeDatabase

async function closeDatabase() {
	await mongoose.connection.close();
}
开发者ID:freezy,项目名称:node-vpdb,代码行数:3,代码来源:check-db.ts

示例7:

test.after("close connection to database", () => {
    mongoose.connection.close();
});
开发者ID:dominikus1993,项目名称:twitterClone,代码行数:3,代码来源:controllerTest.ts

示例8:

const close = () => mongoose.connection.close();
开发者ID:MarcDeletang,项目名称:bedrock,代码行数:1,代码来源:MongooseWrapper.ts

示例9:

 .then(function(){
     mongoose.connection.close();
 })
开发者ID:aurbina83,项目名称:veteranconnect,代码行数:3,代码来源:worker.ts

示例10: after

 after(() => {
   mongoose.connection.close();
 });
开发者ID:eherve,项目名称:mongoose-datatable,代码行数:3,代码来源:datatable.spec.ts


注:本文中的mongoose.connection.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。