Skip to content

Instantly share code, notes, and snippets.

View riyadhalnur's full-sized avatar
🥚

Riyadh Al Nur riyadhalnur

🥚
View GitHub Profile
@riyadhalnur
riyadhalnur / migration.js
Created March 19, 2015 11:03
We have an app running on the MEAN stack and are using MongooseJS as our ORM. Now, we have 2 collections *event* and *eventV2*. We are looking to drop the *event* collection and rename the *eventV2* collection to just *event*.
var mongoose = require('mongoose');
var async = require('async');
var db = 'mongodb://localhost/myawesomeapp';
mongoose.connect(db, function (err) {
if (err) { throw err; }
async.series([_dropCollection, _renameCollection], function (err, result) {
if (err) { throw err; }