Skip to content

Commit b781e69

Browse files
committed
Fix .where() in .join().
1 parent 37bcc81 commit b781e69

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

nosql.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,12 +1939,18 @@ DatabaseBuilder.prototype.join = function(field, name, view) {
19391939

19401940
join = NOSQL(name).find(view);
19411941

1942-
join.where = function(a, b) {
1942+
join.on = function(a, b) {
19431943
self.$join[key].a = a;
19441944
self.$join[key].b = b;
19451945
return join;
19461946
};
19471947

1948+
join.$where = self.where;
1949+
1950+
join.where = function(a, b, c) {
1951+
return c === undefined && typeof(b) === 'string' ? join.on(a, b) : join.$where(a, b, c);
1952+
};
1953+
19481954
join.scalar = function(type, field) {
19491955
self.$join[key].scalar = type;
19501956
self.$join[key].scalarfield = field;

0 commit comments

Comments
 (0)