Mongo ODM, cannot run two queries on the same collection

Hi guys,

I have a collection:

class Keyword extends Collection


public function initialize()


I have two calls in the same function:



I always get only one correct result, the find call returns an empty array, but when I comment out the first call I receive an array of items, the same problem with two ::find calls, instead of ::count

edited May '16

I've found the problem, this is the mongodb log:

2016-05-04 10:23:28.925 COUNT [keywords] : []

2016-05-04 10:23:28.925 QUERY [keyword] : {"$orderby": {"id": -1}, "$query": {}}

the second query tries to use "Keyword" not "Keywords" name of the collection, ignoring $this->setSource("keywords")

any ideas how to solve it?

edited May '16

Solved with:

public function getSource() { return 'keywords'; }

removed initialize()