added count to model, and added support for mysql, mongo and memory.