Interfacing api with mongo