close to getting all nonprofits to render

This commit is contained in:
Michael Q Larson
2015-03-30 20:08:29 -07:00
parent acea52dc1b
commit ca404e66e8
8 changed files with 60 additions and 135 deletions

View File

@@ -2,16 +2,18 @@ require('dotenv').load();
var Bonfire = require('../models/Bonfire.js'),
Courseware = require('../models/Courseware.js'),
Wiki = require('../models/Wiki.js'),
Nonprofit = require('../models/Nonprofit.js'),
mongoose = require('mongoose'),
secrets = require('../config/secrets'),
coursewares = require('./coursewares.json'),
wikis = require('./wikis.json')
wikis = require('./wikis.json'),
nonprofits = require('./nonprofits.json'),
bonfires = require('./bonfires.json');
mongoose.connect(secrets.db);
var counter = 0;
var offerings = 3;
var offerings = 4;
var CompletionMonitor = function() {
counter++;
@@ -75,3 +77,20 @@ Wiki.remove({}, function(err, data) {
});
console.log('wikis');
});
Nonprofit.remove({}, function(err, data) {
if (err) {
console.error(err);
} else {
console.log('Deleted ', data);
}
Nonprofit.create(nonprofits, function(err, data) {
if (err) {
console.log(err);
} else {
console.log('Saved ', data);
}
CompletionMonitor();
});
console.log('nonprofits');
});