davidgtonge / backbone_query

A lightweight query api for Backbone Collections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamic queries not working?

opened this issue · comments

Hey,

I'm trying to create a dynamic query, but it just doesn't seem to want to work, even though the query I'm generating works when I put it in statically. No errors are being thrown... Everything works except the dynamic query.

query = {};

for(i in selected) {
if(selected.hasOwnProperty(i)) {
var terms;

    if(selected[i].indexOf(',') >= 0) {
        terms = {$all: selected[i].split(',')};
    } else {
        terms = selected[i];
    }
}

query[i] = terms;

}

result = this.collection.query(query);
console.log(result);

Hi, please can you re-open this issue if you are still having it.
Thanks