How to use the connections function from mongoose

Find comprehensive JavaScript mongoose.connections code examples handpicked from public code repositorys.

38
39
40
41
42
43
44
45
46
47
UpgradeReminders.plugin(mongooseCommonPlugin, {
  object: 'upgrade_reminder',
  locale: false
});

const conn = mongoose.connections.find(
  (conn) => conn[Symbol.for('connection.name')] === 'MONGO_URI'
);
if (!conn) throw new Error('Mongoose connection does not exist');
module.exports = conn.model('UpgradeReminders', UpgradeReminders);
fork icon71
star icon556
watch icon8