Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-mongo

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-mongo - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

2

lib/connection_queries.js
// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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)

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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)

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.6
Copyright (c) 2013 Vidigami - https://github.com/vidigami/backbone-mongo

@@ -10,3 +10,3 @@ License: MIT (http://www.opensource.org/licenses/mit-license.php)

(function() {
var MemoryCursor, MongoCursor, Queue, util, _, _sortArgsToMongo,
var ARRAY_QUERIES, MemoryCursor, MongoCursor, Queue, util, _, _adaptIds, _sortArgsToMongo,
__hasProp = {}.hasOwnProperty,

@@ -23,2 +23,4 @@ __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; };

ARRAY_QUERIES = ['$or', '$nor', '$and'];
_sortArgsToMongo = function(args, backbone_adapter) {

@@ -41,2 +43,32 @@ var key, sort_part, sorters, value, _i, _len;

_adaptIds = function(query, backbone_adapter, is_id) {
var key, result, value;
if (_.isDate(query)) {
return query;
}
if (_.isArray(query)) {
return (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = query.length; _i < _len; _i++) {
value = query[_i];
_results.push(_adaptIds(value, backbone_adapter, is_id));
}
return _results;
})();
}
if (_.isObject(query)) {
result = {};
for (key in query) {
value = query[key];
result[key === 'id' ? backbone_adapter.id_attribute : key] = _adaptIds(value, backbone_adapter, is_id || key === 'id');
}
return result;
}
if (is_id) {
return backbone_adapter.findId(query);
}
return query;
};
module.exports = MongoCursor = (function(_super) {

@@ -57,24 +89,18 @@ __extends(MongoCursor, _super);

return function(err, find_query) {
var $fields, args, id, id_target, key, value;
var $fields, args, key, _i, _len;
if (err) {
return callback(err);
}
args = [find_query];
if (id = args[0].id) {
delete args[0].id;
if (_.isObject(id)) {
id_target = args[0][_this.backbone_adapter.id_attribute] = {};
for (key in id) {
value = id[key];
id_target[key] = _.isArray(value) ? _.map(value, _this.backbone_adapter.findId) : _this.backbone_adapter.findId(value);
}
} else {
args[0][_this.backbone_adapter.id_attribute] = _this.backbone_adapter.findId(id);
}
}
args = [_adaptIds(find_query, _this.backbone_adapter)];
if (_this._cursor.$ids) {
args[0][_this.backbone_adapter.id_attribute] = {
$in: _.map(_this._cursor.$ids, _this.backbone_adapter.findId)
$in: _adaptIds(_this._cursor.$ids, _this.backbone_adapter, true)
};
}
for (_i = 0, _len = ARRAY_QUERIES.length; _i < _len; _i++) {
key = ARRAY_QUERIES[_i];
if (_this._cursor[key]) {
args[0][key] = _adaptIds(_this._cursor[key], _this.backbone_adapter);
}
}
if (_this._cursor.$values) {

@@ -81,0 +107,0 @@ $fields = _this._cursor.$white_list ? _.intersection(_this._cursor.$values, _this._cursor.$white_list) : _this._cursor.$values;

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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)

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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)

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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)

// Generated by CoffeeScript 1.7.1
/*
backbone-mongo.js 0.5.5
backbone-mongo.js 0.5.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.5.5",
"version": "0.5.6",
"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.6
* Added support for Mongo's '$or', '$nor', '$and'. Currently, backbone-mongo-only
### 0.5.5

@@ -4,0 +7,0 @@ * Bug fix for multiple unset: https://github.com/vidigami/backbone-mongo/issues/7

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc