Search code examples
javascriptbackbone.jsmarionette

query Marionette.js collections


I would like to perform fairly complex filtering on Marionette Collections. Is there way to search for models with a DB like querys like the MongoDB API?

Example:

MarionetteCollection.find( 
{
 type: 'product',
 $or: [ { qty: { $gt: 100 } }, { price: { $lt: 9.95 } } ],
 $and [ { active: true} ],
 $sortby{'name'},
 $order {'asc'}
});

Maybe an extension to Marionette.js?


Solution

  • There is nothing in Marionette to help you here and Marionette doesn't make any changes/additions to the regular Backbone.Collection.

    You could take a look at backbone-query. It appears to do what you are wanting.