How to use the disconnect function from mongoose

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

52
53
54
55
56
57
58
59
60
61
}

// exit function used to cleanup before finishing script
function exit(exitCode) {
  // always disconnect mongo connection
  mongoose.disconnect();

  // only remove sync lock if it was created in this session
  if (!lockCreated || lib.remove_lock(database) == true) {
    // clean exit with previous exit code
fork icon134
star icon53
watch icon7

77
78
79
80
81
82
83
84
85
86
  }, () => {
    console.log(`Mongoose: Connected to ${url + dbname}`);
  });
};
const disconnect = () => {
  return mongoose.disconnect()
    .then((() => console.log('Mongoose: Disconnected.')));
};

const save = (Model, dataArray) => {
fork icon10
star icon49
watch icon5