add mongoose function