backbone-mongo
Advanced tools
Comparing version 0.5.4 to 0.5.5
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -22,4 +22,4 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
_sortArgsToMongo = function(args) { | ||
var key, sort_part, sorters, _i, _len; | ||
_sortArgsToMongo = function(args, backbone_adapter) { | ||
var key, sort_part, sorters, value, _i, _len; | ||
args = _.isArray(args) ? args : [args]; | ||
@@ -29,9 +29,9 @@ sorters = {}; | ||
sort_part = args[_i]; | ||
sort_part = sort_part.trim(); | ||
if (sort_part[0] === '-') { | ||
key = sort_part.substring(1).trim(); | ||
sorters[key] = -1; | ||
} else { | ||
sorters[sort_part] = 1; | ||
key = sort_part.trim(); | ||
value = 1; | ||
if (key[0] === '-') { | ||
key = key.substring(1).trim(); | ||
value = -1; | ||
} | ||
sorters[key === 'id' ? backbone_adapter.id_attribute : key] = value; | ||
} | ||
@@ -96,3 +96,3 @@ return sorters; | ||
} | ||
cursor = cursor.sort(_sortArgsToMongo(_this._cursor.$sort)); | ||
cursor = cursor.sort(_sortArgsToMongo(_this._cursor.$sort, _this.backbone_adapter)); | ||
} | ||
@@ -99,0 +99,0 @@ if (_this._cursor.$offset) { |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -6,0 +6,0 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) |
// Generated by CoffeeScript 1.7.1 | ||
/* | ||
backbone-mongo.js 0.5.4 | ||
backbone-mongo.js 0.5.5 | ||
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo | ||
@@ -125,3 +125,3 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
return _this.connection.collection(function(err, collection) { | ||
var changes, find_query, json, key, keys_to_delete, modifications, value, _i, _len; | ||
var find_query, json, key, modifications, unsets, _i, _len; | ||
if (err) { | ||
@@ -140,15 +140,11 @@ return options.error(err); | ||
}; | ||
if (changes = model.changedAttributes()) { | ||
keys_to_delete = []; | ||
for (key in changes) { | ||
value = changes[key]; | ||
if (_.isUndefined(value)) { | ||
keys_to_delete.push(key); | ||
} | ||
} | ||
if (keys_to_delete.length) { | ||
if (unsets = Utils.get(model, 'unsets')) { | ||
Utils.unset(model, 'unsets'); | ||
if (unsets.length) { | ||
modifications.$unset = {}; | ||
for (_i = 0, _len = keys_to_delete.length; _i < _len; _i++) { | ||
key = keys_to_delete[_i]; | ||
modifications.$unset[key] = ''; | ||
for (_i = 0, _len = unsets.length; _i < _len; _i++) { | ||
key = unsets[_i]; | ||
if (!model.attributes.hasOwnProperty(key)) { | ||
modifications.$unset[key] = ''; | ||
} | ||
} | ||
@@ -155,0 +151,0 @@ } |
{ | ||
"name": "backbone-mongo", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "MongoDB storage for BackboneORM", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Please refer to the following release notes when upgrading your version of BackboneORM. | ||
### 0.5.5 | ||
* Bug fix for multiple unset: https://github.com/vidigami/backbone-mongo/issues/7 | ||
* Bug fix for sort on id: https://github.com/vidigami/backbone-mongo/issues/8 | ||
### 0.5.4 | ||
@@ -4,0 +8,0 @@ * Compatability fix for Backbone 1.1.1 |
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
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
92694
745