Sammaye/MongoYii — pull request #88 by tvollstaedt (2013-06-21 18:51:07+00:00)
Title: Fixed EMongoDocument::search() with pre-defined lists as attributes

Currently, `EMongoDocument::search()` cannot handle list-attributes which are pre-defined in a model. For example in your test application in model `Article`, you pre-defined `likes` with `public $likes=array();`.

When using `search()` on a blank/new model, this empty array will be used as criteria to find entries with zero likes, which is not the preferred bahivour.

I added `count()` to the condition which always returns `1` on any non-countable variable (except its null) and doesn't add empty attributes to the critera query (since it would return 0). To find empty lists/attributes, one may use the [$exists](http://docs.mongodb.org/manual/reference/operator/exists/) query operator.