implemented mongo db stuff