{"id":19521555,"url":"https://github.com/cryptedsnow/laravel-mongodb","last_synced_at":"2026-05-04T18:37:50.267Z","repository":{"id":181328219,"uuid":"666398872","full_name":"CryptedSnow/laravel-mongodb","owner":"CryptedSnow","description":"Simple Laravel application using MongoDB database (codes in Portuguese).","archived":false,"fork":false,"pushed_at":"2024-09-04T22:58:08.000Z","size":4907,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-08T13:54:21.916Z","etag":null,"topics":["laravel","mongodb","nosql","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CryptedSnow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-14T12:18:58.000Z","updated_at":"2024-09-04T22:58:11.000Z","dependencies_parsed_at":"2023-12-24T22:32:31.060Z","dependency_job_id":"3d0322fe-e37e-433c-ab7f-662410f37483","html_url":"https://github.com/CryptedSnow/laravel-mongodb","commit_stats":null,"previous_names":["iury189/laravel-mongodb","cryptedsnow/laravel-mongodb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CryptedSnow%2Flaravel-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CryptedSnow%2Flaravel-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CryptedSnow%2Flaravel-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CryptedSnow%2Flaravel-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CryptedSnow","download_url":"https://codeload.github.com/CryptedSnow/laravel-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240770156,"owners_count":19854793,"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":["laravel","mongodb","nosql","php"],"created_at":"2024-11-11T00:33:14.047Z","updated_at":"2026-05-04T18:37:50.261Z","avatar_url":"https://github.com/CryptedSnow.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://laravel.com\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg\" width=\"400\" alt=\"Laravel Logo\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/laravel/framework/actions\"\u003e\u003cimg src=\"https://github.com/laravel/framework/workflows/tests/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/framework\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/laravel/framework\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/framework\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/laravel/framework\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/laravel/framework\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/laravel/framework\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installing MongoDB database at PC\n\n* [MongoDB PHP Driver](https://www.mongodb.com/docs/drivers/php-drivers/) (Driver to make the application to work with MongoDB in PHP)\n* [MongoDB Community Edition](https://www.mongodb.com/try/download/community) (MongoDB installation).\n* [MongoDB Compass (GUI)](https://www.mongodb.com/try/download/compass) (Graphic interface).\n* [Laravel MongoDB dependency](https://github.com/jenssegers/laravel-mongodb) (MongoDB package for installation on Laravel).\n\n## After clone repository\n\n1 - Run the following command to install dependencies of repository.\n```\ncomposer install\n```\n\n2 - Create `.env` file using the command:\n```\ncp .env.example .env\n```\n\n3 - Run the following command to generate `API_KEY` value of `.env` file.\n```\nphp artisan key:generate\n```\n\n4.1 - Active MongoDB in your PC (I'm using distro Ubuntu of Linux, depending your operating system may be different) using the following command:\n```\nsudo systemctl start mongod\n```\n\n4.2 - Check if MongoDB is enabled.\n```\nsudo systemctl status mongod\n```\n\n4.3 - Case you want to disable.\n```\nsudo systemctl stop mongod\n```\n\n5 - When executing the migrations, is necessary use the commands to create some populated tables to some selection fields at forms.\n\n```\nphp artisan migrate --seed\n```\n\nOr using the commands:\n```\nphp artisan migrate\nphp artisan db:seed\n```\n\n6 - Execute Apache server\n```\nphp artisan serve\n```\n\n## Setting MongoDB database in Laravel project to the first time\n\n1 - Create a Laravel project with compatible version to MongoDB database. Please, verify if your version Laravel application is compatible [here](https://github.com/jenssegers/laravel-mongodb).\n```\ncomposer create-project laravel/laravel project-name\n```\n\n2 - Install MongoDB dependecy.\n```\ncomposer require mongodb/laravel-mongodb\n```\n\n3 - Add the following line in `config/app.php`.\n```\n'providers' =\u003e [\n    ...\n    MongoDB\\Laravel\\MongoDBServiceProvider::class,\n],\n```\n\n4 - Add and replace the following lines in `config/database.php`.\n\n4.1 - Replace:\n```\n'default' =\u003e env('DB_CONNECTION', 'mysql'),\n```\n\n4.2 - To:\n```\n'default' =\u003e env('DB_CONNECTION', 'mongodb'),\n```\n\n4.3 - On same file add `mongodb` settings:\n```\n'connections' =\u003e [\n    ...\n    'mongodb' =\u003e [\n        'driver' =\u003e 'mongodb',\n        'url' =\u003e env('DATABASE_URL'),\n        'host' =\u003e env('DB_HOST', '127.0.0.1'),\n        'port' =\u003e env('DB_PORT', 27017),\n        'database' =\u003e env('DB_DATABASE', 'homestead'),\n        'username' =\u003e env('DB_USERNAME', 'homestead'),\n        'password' =\u003e env('DB_PASSWORD', 'secret'),\n        'options' =\u003e [\n            'appname' =\u003e 'homestead',\n        ],\n    ],\n\n ],\n```\n\n5 - Change the following informations in `.env`.\n```\nDB_CONNECTION=mongodb\nDB_HOST=127.0.0.1\nDB_PORT=27017\nDB_DATABASE=laravel-mongodb\nDB_USERNAME=\nDB_PASSWORD=\n```\n\n## Hunters\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/hunter.png?raw=true)\n\n## Rewards\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/reward.png?raw=true)\n\n## Rewarded\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/rewarded.png?raw=true)\n\n## MongoDB Compass (Hunters table)\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/mongodb_compass1.png?raw=true)\n\n## MongoDB Compass (Rewards table)\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/mongodb_compass2.png?raw=true)\n\n## MongoDB Compass (Rewarded table)\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/mongodb_compass3.png?raw=true)\n\n## Export and import database (on my Linux distro)\n\n1 - Open the terminal and execute the following command to active MongoDB:\n```\nsudo systemctl start mongod\n```\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/1.png?raw=true)\n\n2 - Check if the MongoDB is working execute the following command.\n```\nsudo systemctl status mongod\n```\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/2.png?raw=true)\n\n3 - It will be like this.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/3.png?raw=true)\n\n4 - Open the MongoDB Compass and click on `connect`.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/4.png?raw=true)\n\n5 - Open your database defined to you (in my case `laravel-mongodb`).\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/5.png?raw=true)\n\n6 - Verify existing collections.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/6.png?raw=true)\n\n7 - Go to `home` page\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/7.png?raw=true)\n\n8 - Open the terminal and execute the following command to export `laravel-mongodb` database (Verify the name of your database):\n```\nmongodump --db laravel-mongodb\n```\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/8.png?raw=true)\n\n9 - All collections of database (in my case `laravel-mongodb`) were exported.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/9.png?raw=true)\n\n10 - Back to `home` page and you will notice the existence of `dump` paste.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/10.png?raw=true)\n\n11 - Click on paste of your database (in my case `laravel-mongodb`).\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/11.png?raw=true)\n\n12 - All collections of database (in my case `laravel-mongodb`) are saved in `JSON` and `BSON` files.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/12.png?raw=true)\n\n13 - Back to MongoDB Compass and delete your database clicking on `trash` icon.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/13.png?raw=true)\n\n14 - Confirm the exclusition writing database name (in my case `laravel-mongodb`).\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/14.png?raw=true)\n\n15 - The database was deleted (in my case `laravel-mongodb`).\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/15.png?raw=true)\n\n16 - Open the terminal using the path of database export (in my case `laravel-mongodb`) paste existing in `dump` paste.\n```\ncd ~/dump/laravel-mongodb\n```\n\nThen you will have to insert the following command (Verify the name of database that you want to import, in my case `laravel-mongodb`):\n```\nmongostore --db laravel-mongodb .\n```\n\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/16.png?raw=true)\n\n17 - The database was imported to MongoDB Compass.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/17.png?raw=true)\n\n18 - Return to MongoDB Compass and `refresh` the database.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/18.png?raw=true)\n\n19 - Your database (in my case `laravel-mongodb`) returned.\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/19.png?raw=true)\n\n20 - Return to terminal and write the following command to desactive MongoDB.\n```\nsudo systemctl stop mongod\n```\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/20.png?raw=true)\n\n21 - Check if MongoDB was desactived.\n```\nsudo systemctl status mongod\n```\n![](https://github.com/Iury189/laravel-mongodb/blob/master/public/imagens/21.png?raw=true)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptedsnow%2Flaravel-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptedsnow%2Flaravel-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptedsnow%2Flaravel-mongodb/lists"}