{"id":16443147,"url":"https://github.com/tiaguinho/mongodb-cakephp3","last_synced_at":"2025-10-30T06:01:37.811Z","repository":{"id":53714977,"uuid":"61036235","full_name":"tiaguinho/mongodb-cakephp3","owner":"tiaguinho","description":"An Mongodb datasource for CakePHP 3.0","archived":false,"fork":false,"pushed_at":"2021-03-18T15:27:42.000Z","size":74,"stargazers_count":28,"open_issues_count":12,"forks_count":29,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-09-18T01:11:59.370Z","etag":null,"topics":["cakephp","cakephp3","datasource","mongodb","mongodb-datasource"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiaguinho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-13T12:55:05.000Z","updated_at":"2024-02-19T07:27:37.000Z","dependencies_parsed_at":"2022-09-23T10:15:17.184Z","dependency_job_id":null,"html_url":"https://github.com/tiaguinho/mongodb-cakephp3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaguinho%2Fmongodb-cakephp3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaguinho%2Fmongodb-cakephp3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaguinho%2Fmongodb-cakephp3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaguinho%2Fmongodb-cakephp3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiaguinho","download_url":"https://codeload.github.com/tiaguinho/mongodb-cakephp3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861843,"owners_count":16555980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cakephp","cakephp3","datasource","mongodb","mongodb-datasource"],"created_at":"2024-10-11T09:19:34.943Z","updated_at":"2025-10-30T06:01:37.804Z","avatar_url":"https://github.com/tiaguinho.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Slack](https://img.shields.io/badge/join%20the%20conversation-on%20slack-green.svg)](https://mongodb-cakephp3.slack.com/messages/general/)\n\nMongodb for Cakephp3\n========\n\nAn Mongodb datasource for CakePHP 3.5\n\n## Installing via composer\n\nInstall [composer](http://getcomposer.org) and run:\n\n```bash\ncomposer require hayko/mongodb dev-master\n```\n\n## Connecting the Plugin to your application\n\nadd the following line in your config/bootstrap.php to tell your application to load the plugin:\n\n```php\nPlugin::load('Hayko/Mongodb');\n\n```\n\n## Defining a connection\nNow, you need to set the connection in your config/app.php file:\n\n```php\n 'Datasources' =\u003e [\n    'default' =\u003e [\n        'className' =\u003e 'Hayko\\Mongodb\\Database\\Connection',\n        'driver' =\u003e 'Hayko\\Mongodb\\Database\\Driver\\Mongodb',\n        'persistent' =\u003e false,\n        'host' =\u003e 'localhost',\n        'port' =\u003e 27017,\n        'login' =\u003e '',\n        'password' =\u003e '',\n        'database' =\u003e 'devmongo',\n        'ssh_host' =\u003e '',\n        'ssh_port' =\u003e 22,\n        'ssh_user' =\u003e '',\n        'ssh_password' =\u003e '',\n        'ssh_pubkey_path' =\u003e '',\n        'ssh_privatekey_path' =\u003e '',\n        'ssh_pubkey_passphrase' =\u003e ''\n    ],\n],\n```\n\n### SSH tunnel variables (starting with 'ssh_')\nIf you want to connect to MongoDB using a SSH tunnel, you need to set additional variables in your Datasource. Some variables are unnecessary, depending on how you intend to connect. IF you're connecting using a SSH key file, the ```ssh_pubkey_path``` and ```ssh_privatekey_path``` variables are necessary and the ```ssh_password``` variable is unnecessary. If you're connecting using a text-based password (which is **not** a wise idea), the reverse is true. The function needs, at minimum, ```ssh_host```, ```ssh_user``` and one method of authentication to establish a SSH tunnel.\n\n## Models\nAfter that, you need to load Hayko\\Mongodb\\ORM\\Table in your tables class:\n\n```php\n//src/Model/Table/YourTable.php\n\nuse Hayko\\Mongodb\\ORM\\Table;\n\nclass CategoriesTable extends Table {\n\n}\n```\n\n## Observations\n\nThe function find() works only in the old fashion way.\nSo, if you want to find something, you to do like the example:\n\n```php\n$this-\u003eCategories-\u003efind('all', ['conditions' =\u003e ['name' =\u003e 'teste']]);\n$this-\u003eCategories-\u003efind('all', ['conditions' =\u003e ['name LIKE' =\u003e 'teste']]);\n$this-\u003eCategories-\u003efind('all', ['conditions' =\u003e ['name' =\u003e 'teste'], 'limit' =\u003e 3]);\n```\n\nYou can also use the advanced conditions of MongoDB using the `MongoDB\\BSON` namespace\n\n```php\n$this-\u003eCategories-\u003efind('all', ['conditions' =\u003e [\n    '_id' =\u003e new \\MongoDB\\BSON\\ObjectId('5a7861909db0b47d605c3865'),\n    'foo.bar' =\u003e new \\MongoDB\\BSON\\Regex('^(foo|bar)?baz$', 'i')\n]]);\n```\n\n## LICENSE\n\n[The MIT License (MIT) Copyright (c) 2013](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaguinho%2Fmongodb-cakephp3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiaguinho%2Fmongodb-cakephp3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaguinho%2Fmongodb-cakephp3/lists"}