backbone-db
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -46,3 +46,3 @@ var Backbone = require('backbone'); | ||
var db = model.db || options.db || new Backbone.Db(model.name || model.kind || "model"); | ||
debug("sync %s %s %s",method,model.url(),JSON.stringify(options)); | ||
debug("sync %s %s",method,JSON.stringify(options)); | ||
function callback(err, res, resp) { | ||
@@ -58,3 +58,2 @@ debug('callback '+err+" "+JSON.stringify(res)); | ||
} | ||
switch (method) { | ||
@@ -125,13 +124,16 @@ case 'create': | ||
debug("FINDALL: "+JSON.stringify(model)); | ||
var data = _.chain(this.records) | ||
.map(function(id){ | ||
var data = this.store().getItem(this.name+':'+id, function(err, data) { | ||
var self = this; | ||
var key = this._getKey(model, options); | ||
this.store().getItem(key, function(err, data) { | ||
if(!data || err) { | ||
return cb(err, []); | ||
} | ||
data = data && JSON.parse(data); | ||
data = data.map(function(id) { | ||
data = self.store().getItem(self.name+':'+id, function(err, data) { | ||
return JSON.parse(data); | ||
}); | ||
return data && JSON.parse(data); | ||
}, this) | ||
.compact() | ||
.value(); | ||
return cb(null, data); | ||
}); | ||
return(err, data); | ||
}); | ||
}, | ||
@@ -138,0 +140,0 @@ destroy: function(model, options, cb) { |
{ | ||
"name": "backbone-db", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Key-Value database storage interface, localStorage and in-process implementations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
109949
2575