UNPKG

mh_ms_helper

Version:

Provides the required configuration and connection to Micro services for MH control Central System.

23 lines (21 loc) 813 B
// events-model.js - A mongoose model // // See http://mongoosejs.com/docs/models.html // for more of what you can do here. module.exports = function (app) { const modelName = 'logged_in_users'; const mongooseClient = app.get('mongooseClient'); const { Schema } = mongooseClient; const schema = new Schema({ accessToken: { type: String, required: true }, user : { type: Object} }, { timestamps: true }); // This is necessary to avoid model compilation errors in watch mode // see https://mongoosejs.com/docs/api/connection.html#connection_Connection-deleteModel if (mongooseClient.modelNames().includes(modelName)) { mongooseClient.deleteModel(modelName); } return mongooseClient.model(modelName, schema); };