{"id":16656651,"url":"https://github.com/sheharyarn/mongo-sync-ruby","last_synced_at":"2026-04-01T20:30:35.103Z","repository":{"id":27362873,"uuid":"30838291","full_name":"sheharyarn/mongo-sync-ruby","owner":"sheharyarn","description":"A Ruby Gem for syncing local and remote Mongo Databases","archived":false,"fork":false,"pushed_at":"2016-01-15T15:05:22.000Z","size":18,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-03T16:20:00.704Z","etag":null,"topics":["mongo-sync","mongodb","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/sheharyarn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-15T19:08:17.000Z","updated_at":"2020-05-20T12:27:00.000Z","dependencies_parsed_at":"2022-08-20T23:40:32.323Z","dependency_job_id":null,"html_url":"https://github.com/sheharyarn/mongo-sync-ruby","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sheharyarn/mongo-sync-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fmongo-sync-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fmongo-sync-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fmongo-sync-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fmongo-sync-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheharyarn","download_url":"https://codeload.github.com/sheharyarn/mongo-sync-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fmongo-sync-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mongo-sync","mongodb","rails","ruby"],"created_at":"2024-10-12T09:58:03.002Z","updated_at":"2026-04-01T20:30:35.085Z","avatar_url":"https://github.com/sheharyarn.png","language":"Ruby","readme":"MongoSync\n=========\n\n\u003e Sync Remote and Local MongoDB Databases in Ruby! Works with MongoHQ/Compose, MongoLab and other Heroku-hosted MongoDBs too!\n\nBased on my [mongo-sync](https://github.com/sheharyarn/mongo-sync) shell script.\n\n![MongoSync Ruby Gem Demo GIF](http://i.imgur.com/jvIUfJf.gif)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngroup :development do\n    gem 'mongo_sync'\nend\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install mongo_sync\n```\n\n\n## Usage\n\n### Rails\n\nIn Rails, run this generator to set up a `mongo_sync.yml` configuration template:\n\n```bash\nrails g mongo_sync:config\n```\n\nNow edit the newly created `config/mongo_sync.yml`, putting in details of your remote and local DBs:\n\n```yaml\nlocal:\n  db: 'local_db_name'\n\nremote:\n  db: 'remote_db_name'\n  host:\n    url: 'some.remoteurl.com'\n    port: 27017\n  access:\n    username: 'remote_mongo_user'\n    password: 'remote_mongo_pass'\n\n# For Heroku MongoDB URLs, here's the legend:\n# mongodb://username:password@hosturl.com:port/db_name\n\n# All fields are required\n```\n\nNow, to start syncing, use these rake tasks:\n\n```sh\nrake mongo_sync:push       # Push DB to Remote\nrake mongo_sync:pull       # Pull DB to Local\n```\n\n### Non-Rails\n\n1. Create a `mongo_sync.yml` in your project.\n2. In your project, add this:\n\n    ```ruby\n    require 'rake'\n    require 'mongo_sync'\n    load 'tasks/mongo_sync.rake'\n    ```\n\n3. Pass the path of your config file in the tasks:\n\n    ```sh\n    rake mongo_sync:push['path/to/mongo_sync.yml']\n    ```\n\n### Console / Command-line\n\n```ruby\nrequire 'mongo_sync'\n\n# Looks for config/mongo_sync.yml - Rails only\nMongoSync.pull\n\n# You can pass path of your config file as well\nMongoSync.push \"path/to/mongo_sync.yml\"\n```\n\n\n## Notes \n\n - MongoSync requires `mongodump` and `mongorestore` binaries to be installed in your system. If you have [`mongodb`](http://docs.mongodb.org/manual/tutorial/#getting-started) installed, then you probably already have them\n - Pushing/Pulling ***overwrites*** the Target DB\n - You ***HAVE*** to pass the path of your `mongo_sync.yml` config file in Non-Rails Projects\n - It's a good idea to keep your `mongo_sync.yml` in `.gitignore` or load the values from the `ENV`\n\n\n## TODO\n\n - Add more options and ways to enter DB details in `mongo_sync.yml`\n - Add a `backup` command/task and an `auto-backup` feature\n - Write Tests\n - Add a `no-overwrite` feature, so that it doesn't drop the target DB before restoring it, and _actually_ tries to sync it\n\n\n## Contributing\n\n1. [Fork it](https://github.com/sheharyarn/mongo-sync-ruby/fork)\n2. Create your feature/fix branch (`git checkout -b feature/my-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature/my-feature`)\n5. Create a new Pull Request\n\n\n## License\n\nCopyright (c) 2015 Sheharyar Naseer\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheharyarn%2Fmongo-sync-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheharyarn%2Fmongo-sync-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheharyarn%2Fmongo-sync-ruby/lists"}