How to use the mongoose.disconnect function in mongoose

To help you get started, we’ve selected a few mongoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hughp135 / angular-5-chat-app / back-end / src / tools / db-seeder.ts View on Github external
await user.save();

  console.warn('Creating channels...');
  await createChannels(serverIds);

  console.warn('Creating extra users...');
  await createUsersInServers(serverIds);

  console.warn('Adding friends to main user');
  // await addFriendsToUser(user);

  console.warn('Creating DM channels');
  // await createDMChannels(user);

  console.warn('Finished!');
  await mongoose.disconnect();
  process.exit();
}
github BigFatDog / auth-flow-react-apollo-saga / server / database / mongo.js View on Github external
db.on('error', function(error) {
    console.error('Error in MongoDb connection: ' + error);
    mongoose.disconnect();
  });
  db.on('connected', function() {
github CleverStack / node-seed / bin / seedModels.js View on Github external
function forEachModelTypeComplete( err ) {
        console.log(err ? 'Error: ' : 'Seed completed with no errors', err);
        if ( config.odm && config.odm.enabled ) {
          mongoose.disconnect();
        }
    }
);
github mrlynn / meanstore / data / products-seeder.js View on Github external
function exit() {
	mongoose.disconnect() 
}
github mstraughan86 / Scry / utilities / mongoose.js View on Github external
const disconnect = () => {
  return mongoose.disconnect()
    .then((() => console.log('Mongoose: Disconnected.')));
};
github debelopumento / flashcards / server.js View on Github external
function closeServer() {
    return mongoose.disconnect().then(() => {
        return new Promise((resolve, reject) => {
            console.log("Closing server");
            server.close(err => {
                if (err) {
                    return reject(err);
                }
                resolve();
            });
        });
    });
}
github huridocs / uwazi / app / api / migrations / oldMigrations / relationships_hubs_CEJIL.js View on Github external
.then(() => {
  console.log('');
  console.log('Done!');
  mongoose.disconnect();
})
.catch(console.log);
github mrlynn / meanstore / data / fake-stores.js View on Github external
function exit() {
	mongoose.disconnect()
}
github y-a-r-g / color-themes / backend / Database.js View on Github external
            return new Promise((resolve, reject) => mongoose.disconnect(resolve));
        }
github thegameofcode / resonator / cucumber / features / support / hooks.js View on Github external
function disconnect(done) {
        log.debug('Disconnected from MongoDB');
        mongoose.disconnect(done);
      }