backbone-mongo
Advanced tools
Comparing version 0.6.7 to 0.6.8
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = {}; |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -12,4 +12,4 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
__hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
__hasProp = {}.hasOwnProperty; | ||
@@ -147,2 +147,3 @@ _ref = require('backbone-orm'), _ = _ref._, sync = _ref.sync; | ||
return _this.fetchIncludes(json, function(err) { | ||
var count_cursor; | ||
if (err) { | ||
@@ -152,3 +153,4 @@ return callback(err); | ||
if (_this.hasCursorQuery('$page')) { | ||
return cursor.count(function(err, count) { | ||
count_cursor = new MongoCursor(_this._find, _.pick(_this, ['model_type', 'connection', 'backbone_adapter'])); | ||
return count_cursor.count(function(err, count) { | ||
if (err) { | ||
@@ -155,0 +157,0 @@ return callback(err); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
@@ -16,4 +16,4 @@ /* | ||
module.exports = DatabaseTools = (function() { | ||
function DatabaseTools(sync, options) { | ||
this.sync = sync; | ||
function DatabaseTools(_at_sync, options) { | ||
this.sync = _at_sync; | ||
if (options == null) { | ||
@@ -163,3 +163,3 @@ options = {}; | ||
} | ||
return collection.remove(function(err) { | ||
return collection.remove({}, function(err) { | ||
if (err) { | ||
@@ -166,0 +166,0 @@ if (options.verbose) { |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
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.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var BackboneMongo, BackboneORM, _; |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
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.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -21,6 +21,6 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
module.exports = Connection = (function() { | ||
function Connection(url, schema, options) { | ||
function Connection(_at_url, _at_schema, options) { | ||
var database_url, key, value, _i, _len, _ref1; | ||
this.url = url; | ||
this.schema = schema != null ? schema : {}; | ||
this.url = _at_url; | ||
this.schema = _at_schema != null ? _at_schema : {}; | ||
if (options == null) { | ||
@@ -109,6 +109,7 @@ options = {}; | ||
return _this.db.collection(_this.collection_name, function(err, collection) { | ||
if (!err) { | ||
_this._collection = collection; | ||
if (err) { | ||
return callback(err); | ||
} else { | ||
return callback(null, _this._collection = collection); | ||
} | ||
return callback(err); | ||
}); | ||
@@ -115,0 +116,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
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.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
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.8.0 | ||
// Generated by CoffeeScript 1.9.0 | ||
/* | ||
backbone-mongo.js 0.6.7 | ||
backbone-mongo.js 0.6.8 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -35,5 +35,5 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
MongoSync = (function() { | ||
function MongoSync(model_type, sync_options) { | ||
this.model_type = model_type; | ||
this.sync_options = sync_options != null ? sync_options : {}; | ||
function MongoSync(_at_model_type, _at_sync_options) { | ||
this.model_type = _at_model_type; | ||
this.sync_options = _at_sync_options != null ? _at_sync_options : {}; | ||
this.db = __bind(this.db, this); | ||
@@ -99,6 +99,11 @@ this.deleteCB = __bind(this.deleteCB, this); | ||
doc._rev = 1; | ||
return collection.insert(doc, function(err, docs) { | ||
if (err || !docs || docs.length !== 1) { | ||
return options.error(new Error("Failed to create model. Error: " + (err || 'document not found'))); | ||
return collection.insert(doc, function(err, results) { | ||
var docs; | ||
if (err) { | ||
return options.error(err); | ||
} | ||
docs = results.ops || results; | ||
if (!docs || docs.length !== 1) { | ||
return callback(new Error("Failed to create model. Error: document not found")); | ||
} | ||
return options.success(_this.backbone_adapter.nativeToAttributes(docs[0])); | ||
@@ -144,6 +149,8 @@ }); | ||
"new": true | ||
}, function(err, doc) { | ||
}, function(err, result) { | ||
var doc; | ||
if (err) { | ||
return options.error(new Error("Failed to update model (" + _this.model_type.model_name + "). Error: " + err)); | ||
} | ||
doc = (result != null ? result.value : void 0) || result; | ||
if (!doc) { | ||
@@ -184,4 +191,5 @@ return options.error(new Error("Failed to update model (" + _this.model_type.model_name + "). Either the document has been deleted or the revision (_rev) was stale.")); | ||
return callback(err); | ||
} else { | ||
return Utils.patchRemove(_this.model_type, model, callback); | ||
} | ||
return Utils.patchRemove(_this.model_type, model, callback); | ||
}); | ||
@@ -212,9 +220,10 @@ }; | ||
return callback(err); | ||
} else { | ||
return _this.model_type.each(_.extend({ | ||
$each: { | ||
limit: DESTROY_BATCH_LIMIT, | ||
json: true | ||
} | ||
}, query), _this.deleteCB, callback); | ||
} | ||
return _this.model_type.each(_.extend({ | ||
$each: { | ||
limit: DESTROY_BATCH_LIMIT, | ||
json: true | ||
} | ||
}, query), _this.deleteCB, callback); | ||
}; | ||
@@ -221,0 +230,0 @@ })(this)); |
{ | ||
"name": "backbone-mongo", | ||
"version": "0.6.7", | ||
"version": "0.6.8", | ||
"description": "MongoDB storage for BackboneORM", | ||
@@ -27,3 +27,3 @@ "main": "./lib/index.js", | ||
"test": "ulimit -n 1024; gulp test", | ||
"prepublish": "npm run build" | ||
"prepublish": "gulp build" | ||
}, | ||
@@ -45,7 +45,7 @@ "devDependencies": { | ||
"dependencies": { | ||
"underscore": "1.7.x", | ||
"backbone": "1.1.x", | ||
"underscore": "1.x", | ||
"backbone": "1.x", | ||
"backbone-orm": "0.7.x", | ||
"mongodb": "1.4.x" | ||
"mongodb": "*" | ||
} | ||
} |
Please refer to the following release notes when upgrading your version of BackboneORM. | ||
### 0.6.8 | ||
* Bug fixes for mongo-native 2.x | ||
### 0.6.7 | ||
@@ -4,0 +7,0 @@ * Fix issue with empty results from aggregation ($unique) and $count |
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
Sorry, the diff of this file is not supported yet
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
103196
1044
2
+ Added@mongodb-js/saslprep@1.2.0(transitive)
+ Added@types/webidl-conversions@7.0.3(transitive)
+ Added@types/whatwg-url@11.0.5(transitive)
+ Addedbackbone@1.6.0(transitive)
+ Addedbson@6.10.2(transitive)
+ Addedmemory-pager@1.5.0(transitive)
+ Addedmongodb@6.13.0(transitive)
+ Addedmongodb-connection-string-url@3.0.2(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedsparse-bitfield@3.0.3(transitive)
+ Addedtr46@5.0.0(transitive)
+ Addedunderscore@1.13.7(transitive)
+ Addedwebidl-conversions@7.0.0(transitive)
+ Addedwhatwg-url@14.1.1(transitive)
- Removedabort-controller@3.0.0(transitive)
- Removedbackbone@1.1.2(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbson@0.2.22(transitive)
- Removedbuffer@6.0.3(transitive)
- Removedevent-target-shim@5.0.1(transitive)
- Removedevents@3.3.0(transitive)
- Removedieee754@1.2.1(transitive)
- Removedkerberos@0.0.11(transitive)
- Removedmongodb@1.4.40(transitive)
- Removednan@1.8.4(transitive)
- Removedprocess@0.11.10(transitive)
- Removedreadable-stream@4.7.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedunderscore@1.7.0(transitive)
Updatedbackbone@1.x
Updatedmongodb@*
Updatedunderscore@1.x