Closed sp90 closed 6 years ago
You shouldn't need spaghetti code...
let scan = Messages
.scan()
.startKey(lastKey)
.limit(10);
if (query && query.length) {
scan = scan.where('message_subject_internal').contains(query);
}
scan.exec(callback);
This seems perfectly readable to me, and is a fairly standard way to conditionally build queries/scans.
Thanks 👍
Okay so i want to query by some values
Lets say
query
is empty shouldn't the framework just not add the filter query that way i dont have to do all the cases in my routeOtherwise i can end up with some serious spagetti code?