0

Trying to work out how to do a mongoid query to return Documents with a range of embeded documents e.g.

class Question
  embeds_many :question_response,

get questions that have only 1,2 or 3 responses

Question.between(:question_response.count, 1, 3) 

Any ideas?

dboyd68
  • 1,104
  • 15
  • 33
  • 1
    possible duplicate of [In MongoDB, how do I find documents where array size is greater than 1?](http://stackoverflow.com/questions/7811163/in-mongodb-how-do-i-find-documents-where-array-size-is-greater-than-1) – mu is too short Jan 24 '14 at 06:06
  • that question is about size of an array, I am looking to count the number of embedded objects – dboyd68 Jan 24 '14 at 21:45
  • But looking for things with 1, 2, or 3 responses *is* about the size of the array. – mu is too short Jan 24 '14 at 21:46

1 Answers1

0

For those who wanted to know.

with_size worked.

Thanks

dboyd68
  • 1,104
  • 15
  • 33