adding mongodb queries to function
added geoip requirement