You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tableRules: {//NEW: SET rules to joined tables too!
63
+
table: "comments",//NEW SET table name inside any property u want!
64
+
limit: 50,
65
+
orderByDesc: "commentId"//give me the first 50 comments ordered by -commentId (DESC) from table 'comments' and put them at 'myComments' property inside the result object.
66
+
}
67
+
}
68
+
}).then(_user=>{// to get this promise use : .promise()
console.log(_user.userId+" "+_user.username+" found with "+_user.comments.length+" comments");
110
+
111
+
});
112
+
113
+
});
114
+
//if no rules setted to find method it's uses the table's rules ( if exists)
115
+
116
+
117
+
118
+
let_criteriaFromBuilder=usersDb.criteria
119
+
.except("password")// or .exclude(...columns). the only column you cannot except/exclude is the primary key (because it is used at where clause), be careful.
120
+
.where("userId",24)
121
+
.joinAs("info","userInfos","userId")
122
+
.at("info")
123
+
.limit(1)//because we make it limit 1 it will return this result as object not as array.
124
+
.parent()
125
+
.joinAs("myComments","comments","userId")
126
+
.at("myComments").limit(2)
127
+
.joinAs("likes","commentLikes","commentId")
128
+
.original().orderBy("userId",true).build();
129
+
130
+
/* console.dir(_criteriaFromBuilder);
131
+
prints this object: ( of course you can create your own in order to pass it on .find table methods )
0 commit comments