Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
db.on('error', function(error) {
console.error('Error in MongoDb connection: ' + error);
mongoose.disconnect();
});
db.on('connected', function() {
function forEachModelTypeComplete( err ) {
console.log(err ? 'Error: ' : 'Seed completed with no errors', err);
if ( config.odm && config.odm.enabled ) {
mongoose.disconnect();
}
}
);
function exit() {
mongoose.disconnect()
}
const disconnect = () => {
return mongoose.disconnect()
.then((() => console.log('Mongoose: Disconnected.')));
};
function closeServer() {
return mongoose.disconnect().then(() => {
return new Promise((resolve, reject) => {
console.log("Closing server");
server.close(err => {
if (err) {
return reject(err);
}
resolve();
});
});
});
}
.then(() => {
console.log('');
console.log('Done!');
mongoose.disconnect();
})
.catch(console.log);
function exit() {
mongoose.disconnect()
}
return new Promise((resolve, reject) => mongoose.disconnect(resolve));
}
function disconnect(done) {
log.debug('Disconnected from MongoDB');
mongoose.disconnect(done);
}