0

I have collection name @collection. Each model of @collection looks like this:

{
name : "example",
layout : {
    x : 100,
    y : 100,
  }
}

I have to do find models where model.attributes.layout[x] == '100'.

Can I do something like this @collection.where({layout[x] :100}) ? Or are there other ways to do such kind of query?

vidal
  • 345
  • 3
  • 18

1 Answers1

1

use filter method

collection.filter(function(model) { return model.get('layout).x === 100; })

djaszczurowski
  • 4,385
  • 1
  • 18
  • 28