Not strict equal when matching ids in embedded lists
This commit is contained in:
parent
4ce4a0bc2c
commit
cca1cbb3f8
|
@ -18,7 +18,7 @@ Feel free to vote and comment on cards (tickets/issues), if you want to join tea
|
|||
|
||||
```javascript
|
||||
var Schema = require('./jugglingdb').Schema;
|
||||
var schema = new Schema('redis', {port: 6379}); //port number depends on your configuration
|
||||
var schema = new Schema('redis2', {port: 6379}); //port number depends on your configuration
|
||||
// define models
|
||||
var Post = schema.define('Post', {
|
||||
title: { type: String, length: 255 },
|
||||
|
|
|
@ -427,8 +427,8 @@ BridgeToRedis.prototype.all = function all(model, filter, callback) {
|
|||
|
||||
// LIMIT
|
||||
if (filter.limit){
|
||||
var from = (filter.offset || 0), to = from + filter.limit;
|
||||
sortCmd.push("LIMIT", from, to);
|
||||
var offset = (filter.offset || 0), limit = filter.limit;
|
||||
sortCmd.push("LIMIT", offset, limit);
|
||||
}
|
||||
|
||||
// we need ALPHA modifier when sorting string values
|
||||
|
|
|
@ -130,10 +130,14 @@ List.prototype.push = function (obj) {
|
|||
|
||||
List.prototype.remove = function (obj) {
|
||||
var id = obj.id ? obj.id : obj;
|
||||
console.log(id);
|
||||
var found = false;
|
||||
this.items.forEach(function (o, i) {
|
||||
if (o.id === id) found = i;
|
||||
if (id && o.id == id) {
|
||||
found = i;
|
||||
if (o.id !== id) {
|
||||
console.log('WARNING! Type of id not matched');
|
||||
}
|
||||
}
|
||||
});
|
||||
if (found !== false) {
|
||||
delete this[id];
|
||||
|
|
Loading…
Reference in New Issue