diff --git a/extensions/debug/panels/DbPanel.php b/extensions/debug/panels/DbPanel.php
index 37bde4ebbb..a654463680 100644
--- a/extensions/debug/panels/DbPanel.php
+++ b/extensions/debug/panels/DbPanel.php
@@ -47,6 +47,14 @@ class DbPanel extends Panel
return 'Database';
}
+ /**
+ * @return string short name of the panel, which will be use in summary.
+ */
+ public function getSummaryName()
+ {
+ return 'DB';
+ }
+
/**
* @inheritdoc
*/
diff --git a/extensions/debug/views/default/panels/db/detail.php b/extensions/debug/views/default/panels/db/detail.php
index 4bd839f538..709291ec15 100644
--- a/extensions/debug/views/default/panels/db/detail.php
+++ b/extensions/debug/views/default/panels/db/detail.php
@@ -7,7 +7,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
?>
-
Database Queries
+= $panel->getName(); ?> Queries
diff --git a/extensions/mongodb/CHANGELOG.md b/extensions/mongodb/CHANGELOG.md
index 08b5b73ffb..85b3e180dc 100644
--- a/extensions/mongodb/CHANGELOG.md
+++ b/extensions/mongodb/CHANGELOG.md
@@ -23,6 +23,7 @@ Yii Framework 2 mongodb extension Change Log
- Enh #3520: Added `unlinkAll()`-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
- Enh #3778: Gii generator for Active Record model added (klimov-paul)
- Enh #3947: Migration support added (klimov-paul)
+- Enh #3855: Enh: Added a debug toolbar panel for MongoDB (klimov-paul)
- Enh #4048: Added `init` event to `ActiveQuery` classes (qiangxue)
- Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
- Enh #4335: `yii\mongodb\log\MongoDbTarget` log target added (klimov-paul)
diff --git a/extensions/mongodb/README.md b/extensions/mongodb/README.md
index 4ee7a70510..19171b5fc5 100644
--- a/extensions/mongodb/README.md
+++ b/extensions/mongodb/README.md
@@ -288,6 +288,32 @@ return [
is very basic and definitely requires adjustments.
+Using the MongoDB DebugPanel
+----------------------------
+
+The yii2 MongoDB extensions provides a debug panel that can be integrated with the yii debug module
+and shows the executed MongoDB queries.
+
+Add the following to you application config to enable it (if you already have the debug module
+enabled, it is sufficient to just add the panels configuration):
+
+```php
+ // ...
+ 'bootstrap' => ['debug'],
+ 'modules' => [
+ 'debug' => [
+ 'class' => 'yii\\debug\\Module',
+ 'panels' => [
+ 'mongodb' => [
+ 'class' => 'yii\\mongodb\\debug\\MongoDbPanel',
+ ],
+ ],
+ ],
+ ],
+ // ...
+```
+
+
Using Migrations
----------------
diff --git a/extensions/mongodb/debug/MongoDbPanel.php b/extensions/mongodb/debug/MongoDbPanel.php
new file mode 100644
index 0000000000..35b5fd93ed
--- /dev/null
+++ b/extensions/mongodb/debug/MongoDbPanel.php
@@ -0,0 +1,51 @@
+
+ * @since 2.0
+ */
+class MongoDbPanel extends DbPanel
+{
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return 'MongoDB';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getSummaryName()
+ {
+ return 'MongoDB';
+ }
+
+ /**
+ * Returns all profile logs of the current request for this panel.
+ * @return array
+ */
+ public function getProfileLogs()
+ {
+ $target = $this->module->logTarget;
+
+ return $target->filterMessages($target->messages, Logger::LEVEL_PROFILE, [
+ 'yii\mongodb\Collection::*',
+ 'yii\mongodb\Query::*',
+ 'yii\mongodb\Database::*',
+ ]);
+ }
+}
\ No newline at end of file