twoh/twoh_mongodb_driver 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

twoh/twoh_mongodb_driver

最新稳定版本:1.0.6

Composer 安装命令:

composer require twoh/twoh_mongodb_driver

包简介

Extends TYPO3 to support MongoDB.

README 文档

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

If you find this extension useful and want to support its continued development, please consider becoming a sponsor. Your support helps maintain and improve this project, add new features, and keep it compatible with the latest TYPO3 versions. Every contribution, no matter how small, makes a difference!

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.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-06-09