changed to mongoose, introduced aggregate queries