Skip to content

Commit 67bff07

Browse files
author
hxoliverrumbelow
committed
Filter resources at the database level
1 parent 572580e commit 67bff07

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/mongoHandler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ MongoStore.prototype._getSearchCriteria = function(request) {
5858
if (!attributeConfig) return partialCriteria;
5959

6060
var values = request.params.filter[attribute];
61+
if (attributeConfig._settings) {
62+
attribute += ".id";
63+
}
64+
6165
if (!(values instanceof Array)) values = [ values ];
6266
values = values.map(function(value) {
6367
if (value[0] === "<") return { $lt: value.substring(1) };
@@ -71,10 +75,6 @@ MongoStore.prototype._getSearchCriteria = function(request) {
7175
return tmp;
7276
});
7377

74-
if (attributeConfig._settings) {
75-
attribute += ".id";
76-
}
77-
7878
partialCriteria[attribute] = values;
7979
return partialCriteria;
8080
}, { });

0 commit comments

Comments
 (0)