Skip to content

Instantly share code, notes, and snippets.


nparsons08/db.js Secret

Created Nov 3, 2019
What would you like to do?
import mongoose from 'mongoose';
import dotenv from 'dotenv';
mongoose.Promise = global.Promise;
const connection = mongoose.connect(process.env.MONGODB_URI, {
autoIndex: true,
reconnectTries: Number.MAX_VALUE,
reconnectInterval: 500,
poolSize: 50,
bufferMaxEntries: 0,
keepAlive: 120,
useNewUrlParser: true,
mongoose.set('useCreateIndex', true);
.then(db => db)
.catch(err => {
export default connection;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.