chris
chris

Reputation: 36937

Query Collection using Where with a less than or greater than statement in it?

Does backbone collections using .where() or like function accept some form of less/greater-than statements such as <=, >=, <, >

I cant find anything in the documentation that says anything either way

Upvotes: 1

Views: 481

Answers (1)

mu is too short
mu is too short

Reputation: 434695

No, where doesn't support that. From the fine manual:

where collection.where(attributes)

Return an array of all the models in a collection that match the passed attributes. Useful for simple cases of filter.

where is just a filter call in disguise so you can use filter (which is mixed into Backbone collections) directly for more complicated things:

var matches = collection.filter(function(m) {
    /* check model `m` here */
});

Upvotes: 2

Related Questions