reworked library to mongoose 3.8