83% [308/938]
88% [210/443]
89% [201/432]
78% [198/408]
73% [181/404]
77% [180/367]
94% [116/530]
97% [95/190]
+ spec] = cond;4
  • }
  • } else {
  • if (cond === null) {
  • query[k] = {$type: 10};1
  • } else {
  • query[k] = cond;10
  • }
  • }
  • });16
  • }
  • var cursor = this.collection(model).find(query);21
  • if (filter.order) {
  • var m = filter.order.match(/\s+(A|DE)SC$/);6
  • var key = filter.order;6
  • var reverse = false;6
  • if (m) {
  • key = key.replace(/\s+(A|DE)SC$/, '');3
  • if (m[1] === 'DE') reverse = true;3
  • }
  • if (reverse) {
  • cursor.sort([[key, 'desc']]);2
  • } else {
  • cursor.sort(key);4
  • }
  • }
  • if (filter.limit) {
  • cursor.limit(filter.limit);5
  • }
  • if (filter.skip) {
  • cursor.skip(filter.skip);
  • } else if (filter.offset) {
  • cursor.skip(filter.offset);
  • }
  • cursor.toArray(function (err, data) {
  • if (err) return callback(err);21
  • callback(null, data.map(function (o) { o.id = o._id.toString(); delete o._id; return o; }));21
  • });21
  • };1
  • MongoDB.prototype.destroyAll = function destroyAll(model, callback) {
  • this.collection(model).remove({}, callback);3
  • };1
  • MongoDB.prototype.count = function count(model, callback, where) {
  • this.collection(model).count(where, function (err, count) {
  • callback(err, count);3
  • });3
  • };1
  • MongoDB.prototype.updateAttributes = function updateAttrs(model, id, data, cb) {
  • this.collection(model).findAndModify({_id: new ObjectID(id)}, [['_id','asc']], {$set: data}, {}, function(err, object) {
  • cb(err, object);2
  • });2
  • };1
  • MongoDB.prototype.disconnect = function () {
  • this.client.close();1
  • };1
  • lib/adapters/memory.js
    99% [84/175]
    lib/schema.js
    94% [80/314]
    lib/sql.js
    95% [75/161]
    lib/adapters/mongoose.js
    100% [44/227]
    lib/hookable.js
    100% [25/52]
    lib/jutil.js
    100% [5/10]
    lib/utils.js
    50% [4/12]