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);
71
556
8
mongoose.model is the most popular function in mongoose (2160 examples)