library/Storage/Adapter/Mongo/MongoAdapterAbstractServiceFactory.php
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->getConfig($serviceLocator)[$requestedName];
        /** @var $mongoDb \MongoDB */
        $mongoDb = $serviceLocator->get($config['database']);
        $mongoCollection = new \MongoCollection($mongoDb, $config['collection']);
        $adapter = new MongoAdapter();
        if (isset($config['identifier'])) {
            $adapter->setIdentifierName($config['identifier']);
        }
        return $adapter->setMongoCollection($mongoCollection);
    }
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->getConfig($serviceLocator)[$requestedName];
        /** @var $mongoDb \MongoDB */
        $mongoDb = $serviceLocator->get($config['database']);
        $mongoCollection = new \MongoCollection($mongoDb, $config['collection']);
        $adapter = new MongoAdapter();
        if (isset($config['identifier'])) {
            $adapter->setIdentifierName($config['identifier']);
        }
        return $adapter->setMongoCollection($mongoCollection);
    }
Create service with name

@param ServiceLocatorInterface $serviceLocator
@param string $name
@param string $requestedName
@return StorageInterface