I assume company_ids is an array field in a personal document
I am afraid that there is no way to indicate the conditions in size. But there is a workaround using javascript $, where the expression
db.person.find({$where: '(this.company_ids.length > 0)'})
I am not sure how to pass this expression to mongoid.
EDIT
Yes, you can do it with a mangoid too
Person.where("$where" => 'this.company_ids.length >0;' )
source share