backbone-mongo
Advanced tools
Comparing version 0.6.5 to 0.6.6
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = {}; |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -179,3 +179,3 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
return function(err, collection) { | ||
var field, group_args, group_id_args, pipeline, sort, _i, _j, _len, _len1, _ref1; | ||
var count_pipeline, field, group_args, group_id_args, pipeline, sort, _i, _j, _len, _len1, _ref1; | ||
if (err) { | ||
@@ -220,5 +220,13 @@ return callback(err); | ||
}); | ||
if (_this.hasCursorQuery('$page')) { | ||
count_pipeline = [].concat(pipeline); | ||
} | ||
if (sort) { | ||
pipeline.push(sort); | ||
} | ||
if (_this._cursor.$offset) { | ||
pipeline.push({ | ||
$skip: _this._cursor.$offset | ||
}); | ||
} | ||
if (_this._cursor.$one || _this.hasCursorQuery('$exists')) { | ||
@@ -233,16 +241,4 @@ pipeline.push({ | ||
} | ||
if (_this._cursor.$offset) { | ||
pipeline.push({ | ||
$skip: _this._cursor.$offset | ||
}); | ||
} | ||
if (_this._cursor.$count) { | ||
pipeline.push({ | ||
$group: { | ||
_id: null, | ||
count: { | ||
$sum: 1 | ||
} | ||
} | ||
}); | ||
return _this._aggregateCount(collection, pipeline, callback); | ||
} | ||
@@ -254,5 +250,2 @@ return collection.aggregate(pipeline, {}, function(err, results) { | ||
} | ||
if (_this._cursor.$count) { | ||
return callback(null, results[0].count); | ||
} | ||
for (_k = 0, _len2 = results.length; _k < _len2; _k++) { | ||
@@ -264,3 +257,21 @@ result = results[_k]; | ||
} | ||
return callback(null, _this.selectResults(results)); | ||
return _this.fetchIncludes(results, function(err) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (_this.hasCursorQuery('$page')) { | ||
return _this._aggregateCount(collection, count_pipeline, function(err, count) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, { | ||
offset: _this._cursor.$offset || 0, | ||
total_rows: count, | ||
rows: _this.selectResults(results) | ||
}); | ||
}); | ||
} else { | ||
return callback(null, _this.selectResults(results)); | ||
} | ||
}); | ||
}); | ||
@@ -271,2 +282,20 @@ }; | ||
MongoCursor.prototype._aggregateCount = function(collection, pipeline, callback) { | ||
return collection.aggregate(pipeline.concat([ | ||
{ | ||
$group: { | ||
_id: null, | ||
count: { | ||
$sum: 1 | ||
} | ||
} | ||
} | ||
]), {}, function(err, results) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, results[0].count); | ||
}); | ||
}; | ||
return MongoCursor; | ||
@@ -273,0 +302,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
@@ -3,0 +3,0 @@ /* |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var BackboneMongo, BackboneORM, _; |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.7.1 | ||
// Generated by CoffeeScript 1.8.0 | ||
/* | ||
backbone-mongo.js 0.6.5 | ||
backbone-mongo.js 0.6.6 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
{ | ||
"name": "backbone-mongo", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"description": "MongoDB storage for BackboneORM", | ||
@@ -34,3 +34,3 @@ "main": "./lib/index.js", | ||
"coffee-script": "*", | ||
"express": "3.x", | ||
"express": "4.x", | ||
"gulp": "*", | ||
@@ -42,6 +42,6 @@ "gulp-coffee": "*", | ||
"event-stream": "*", | ||
"supertest": "*" | ||
"supertest": "0.13.x" | ||
}, | ||
"dependencies": { | ||
"underscore": "1.6.x", | ||
"underscore": "1.7.x", | ||
"backbone": "1.1.x", | ||
@@ -48,0 +48,0 @@ "backbone-orm": "0.7.x", |
Please refer to the following release notes when upgrading your version of BackboneORM. | ||
### 0.6.6 | ||
* $unique does not work properly with $page: https://github.com/vidigami/backbone-mongo/issues/14 | ||
### 0.6.5 | ||
@@ -4,0 +7,0 @@ * Upgrade to BackboneORM 0.7.x |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102245
1031
+ Addedunderscore@1.7.0(transitive)
- Removedunderscore@1.6.0(transitive)
Updatedunderscore@1.7.x