twoh/twoh_mongodb_driver

Extends TYPO3 to support MongoDB.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:typo3-cms-extension

pkg:composer/twoh/twoh_mongodb_driver

1.0.5 2025-12-09 12:59 UTC

This package is auto-updated.

Last update: 2025-12-09 13:03:38 UTC


README

TYPO3 13 PHP License Version MongoDB GitHub Issues

Extends TYPO3 to support MongoDB as a database backend.

📑 Table of Contents

General Info

This TYPO3 extension provides a MongoDB driver that allows you to connect and interact with MongoDB databases directly from your TYPO3 installation.

Keywords: TYPO3 extension MongoDB driver database

Getting Started

Prerequisites

Requirement Version
PHP >=8.2 <8.4
TYPO3 ^13.4
MongoDB Library >=1.17 <2.0
ext-mongodb >=1.17

Installation

  1. Install the extension via Composer:

    composer require twoh/twoh_mongodb_driver
  2. Activate the extension in the TYPO3 Extension Manager.

Configuration

Add the driver connection settings to your config/system/settings.php or config/system/additional.php:

$GLOBALS['TYPO3_CONF_VARS']['DRIVER']['MongoDB'] = [
    'host'     => getenv('TOOL_DB_HOST'),
    'dbname'   => getenv('TOOL_DB_DATABASE'),
    'user'     => getenv('TOOL_DB_USERNAME'),
    'password' => getenv('TOOL_DB_PASSWORD'),
    'port'     => getenv('TOOL_DB_PORT'),
];

Usage

Basic Usage

Access the ConnectionPool object to execute your queries:

Namespace: TWOH\TwohMongodbDriver\Adapter\MongodbConnectionPoolAdapter

$mongodbConnectionPoolAdapter = GeneralUtility::makeInstance(MongodbConnectionPoolAdapter::class);

$mongodbConnectionPoolAdapter->getConnectionPool()->selectDocuments(
    $collectionName, 
    $filter,
    $options
);

Full Example

The following example demonstrates how to query MongoDB and return the results to your view:

protected MongodbConnectionPoolAdapter $mongodbConnectionPoolAdapter;

public function __construct(
    protected MongodbConnectionPoolAdapter $mongodbConnectionPoolAdapter
) {
}

public function indexAction(
    ServerRequestInterface $request,
    ModuleTemplate $view
): ResponseInterface {
    $view->assignMultiple([
        'users' => $this->mongodbConnectionPoolAdapter->getConnectionPool()->selectDocuments(
            'user',
            [
                'uuid' => 'user1',
            ],
            [
                'limit' => 5,
                'projection' => [
                    'uuid' => 1,
                    'username' => 1,
                    'email' => 1,
                    'name' => 1,
                    'pageInteractions' => 1,
                ],
            ],
        )
    ]);
    
    return $view->renderResponse('AdminModule/Index');
}

Charts

This extension integrates charts via Chart.js.

Documentation

📖 ConnectionPool Functions – Detailed documentation of all available ConnectionPool methods.

📚 Official Documentation – Full documentation on docs.typo3.org.

Support

Authors

Name Role Contact
Andreas Reichel Developer a.reichel91@outlook.com
Igor Smertin Developer igor.smertin@web.de

License

This project is licensed under the GPL-2.0-or-later license. See the LICENSE file for details.