Skip to content

Commit 5a3543c

Browse files
committed
Fix a problem with nosql_builder.join() by @yexing.
1 parent d85c588 commit 5a3543c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- fixed: global alias `I` for isomorphic code
2929
- fixed: streaming files in `debug` mode (removed cache)
3030
- fixed: (critical) a bug with authorization in WebSocket
31+
- fixed: `nosql_builder.join()` a problem with using `nosql_builder.first()` by @yexing (Xing Ye)
3132

3233
- improved: CSS compression
3334
- improved: code

nosql.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,12 @@ DatabaseBuilder.prototype.$callback2 = function(err, response, count) {
12971297
item[join.field] = join.scalar ? scalar(join.items, join.scalar, join.scalarfield, join.a, join.b != null ? item[join.b] : undefined) : join.first ? findItem(join.items, join.a, item[join.b], join.scalar, join.scalarfield) : findItems(join.items, join.a, item[join.b]);
12981298
}
12991299
}
1300-
} else if (response)
1301-
response[join.field] = join.scalar ? scalar(join.items, join.scalar, join.scalarfield, join.a, join.b != null ? response[join.b] : undefined) : join.first ? findItem(join.items, join.a, response[join.b]) : findItems(join.items, join.a, response[join.b]);
1300+
} else if (response) {
1301+
for (var j = 0; j < jl; j++) {
1302+
var join = self.$join[keys[j]];
1303+
response[join.field] = join.scalar ? scalar(join.items, join.scalar, join.scalarfield, join.a, join.b != null ? response[join.b] : undefined) : join.first ? findItem(join.items, join.a, response[join.b], join.scalar, join.scalarfield) : findItems(join.items, join.a, response[join.b]);
1304+
}
1305+
}
13021306

13031307
self.$callback(err, response, count);
13041308
return self;

0 commit comments

Comments
 (0)