Phalcon 3.2 with PHP 7 and MongoDB 3.0.15

I am trying to integrate with MongoDB but I am getting error. This is what i did: In my DI file:

use Phalcon\Mvc\Collection\Manager as CollectionManager;
use Phalcon\Db\Adapter\MongoDB\Client;
//connect to Mongo
$di->set(
    "mongo",
function () use ($config) {
  $mongo = new MongoClient(
    "mongodb://" . $config->mongo->username . ":". $config->mongo->password . "@" . $config->mongo->host . ":" . $config->mongo->port
  );
  $mongo->selectDB('test');
},
);

// Collection Manager is required for MongoDB
    $di->set('collectionManager', function(){
    return new CollectionManager();
});

I created a model:

namespace App\Models;
use Phalcon\Mvc\Collection;
class APILog extends Collection
{
    public $id;
    public $ip;
    public $timestamp;
    public $api;

    public function initialize()
    {
        $this->setSource("logs");
    }
    public function showdoc($id)
    {
        print $id;
    }

}

In my service file i tried to access this APILog class: use App\Models\Log; public function writeLog($something){ $k = new APILog($something); }

This gives me 500 error.

My folder structure goes like this:
/
/config
    config.php
    routes.php
    loader.php
    di.php
/controllers
    mycontroller.php
    Abstractexception.php
    Abstratcontroller.php  #this extends \Phalcon\DI\Injectable
/models
    mymodel.php
    APILog.php
/services
     AbstractService.php #this extends \Phalcon\DI\Injectable
    myservice.php

Can anyone please suggest what i am missing here. I need to store the Log reports.

Could you start by activating PHP errors to get an actually clear and readable error ?

Add these two lines in your public/index.php script, below error_reporting(E_ALL) (technically the fourth line if you used phalcon-devtools to generate your project).

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');

After that, try to refresh and paste the full error here.