mde/model — pull request #96 by tarnazar (2013-09-03 22:04:18+00:00)
Title: Update index.js

add count functions

obj.count = function() {
var args = Array.prototype.slice.call(arguments)
, callback = args.pop() || function () {};
adapt = model.getAdapterForModel(name);
if (!adapt) {
throw new Error('Adapter not found for ' + name);
}
else {
if (adapt.name == 'postgres') {
throw new Error('Only mongodb adapters support.');
}
}
return adapt.count(model[name],callback);
}