added function to aid mongoose