Skip to content

Commit

Permalink
Merge branch 'master' of github.com:AF83/Geeks
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuo committed Jan 9, 2011
2 parents 01fdfee + fb5155f commit 0177e30
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
exports.db = {
host: 'localhost',
port: 27017,
db_name: 'Geeks_dev'
db_name: 'Geeks_dev',
// Max number of URLs in DB:
max_nb_urls: 200
}

exports.server = {
Expand Down
19 changes: 19 additions & 0 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ var rest_mongo = require("rest-mongo/core")
var backend = mongo_backend.get_backend(config.db);
exports.RFactory = rest_mongo.getRFactory(schema, backend);

// In case we need to delete the URL collection:
// backend.db.dropCollection('URL', function(err){
// if(err) {
// console.error(err);
// }
// });

// We don't want more than X urls in our DB:
var MAX_NB_URLS = config.db.max_nb_urls;
backend.db.createCollection("URL", {
capped:true
, size:MAX_NB_URLS*1000
, max:MAX_NB_URLS
}, function(err, collection) {
if(err) {
console.error(err);
}
});

5 changes: 3 additions & 2 deletions src/scripts/load_dev_data.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* Load some data in DB for dev env.
*/

require.paths.unshift(__dirname + '/../vendor/nodetk/src')
require.paths.unshift(__dirname + '/../../vendor/nodetk/src')
require.paths.unshift(__dirname + '/../../vendor/rest-mongo/src')

var sys = require("sys"),
RFactory = require("../db").RFactory,
RFactory = require("../model").RFactory,
R = RFactory()


Expand Down

0 comments on commit 0177e30

Please sign in to comment.