{"id":15685218,"url":"https://github.com/phstc/mongomapper_id2","last_synced_at":"2025-05-07T17:41:30.209Z","repository":{"id":1270291,"uuid":"1209443","full_name":"phstc/mongomapper_id2","owner":"phstc","description":"It’s a MongoMapper’s plugin to add auto incremented ids in MongoMapper’s documents.","archived":false,"fork":false,"pushed_at":"2013-12-21T22:32:22.000Z","size":150,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T18:00:31.362Z","etag":null,"topics":[],"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/phstc.png","metadata":{"files":{"readme":"README.rdoc","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":"2010-12-30T20:55:07.000Z","updated_at":"2020-05-02T21:13:53.000Z","dependencies_parsed_at":"2022-08-16T12:50:37.829Z","dependency_job_id":null,"html_url":"https://github.com/phstc/mongomapper_id2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phstc%2Fmongomapper_id2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phstc%2Fmongomapper_id2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phstc%2Fmongomapper_id2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phstc%2Fmongomapper_id2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phstc","download_url":"https://codeload.github.com/phstc/mongomapper_id2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232654884,"owners_count":18556472,"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":[],"created_at":"2024-10-03T17:24:20.719Z","updated_at":"2025-01-06T00:07:02.606Z","avatar_url":"https://github.com/phstc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= mongomapper_id2\n\nIt’s a MongoMapper’s plugin to add auto incremented ids in MongoMapper’s documents.\n\nThis gem was based on this post http://ihswebdesign.com/blog/autoincrement-in-mongodb-with-ruby/\n\n== Installation\n\n  # https://rubygems.org/gems/mongomapper_id2\n  $ gem install mongomapper_id2\n\nor\n\n  # Gemfile\n  gem 'mongomapper_id2'\n\n\n== Usage\n\n  # app/models/movie.rb\n  class Movie\n    include MongoMapper::Document\n    \n    key :title, String \n    \n    # Here is the mongomapper_id2\n    auto_increment!\n  end\n  \n  movie = Movie.create(:title =\u003e 'The Simpsons Movie')\n  movie.id # BSON::ObjectId('4d1d150d30f2246bc6000001') \n  \n  # Here is the mongomapper_id2\n  movie.id2\n  # =\u003e 1\n  \n  movie2 = Movie.create(:title =\u003e 'Pirates of Silicon Valley')\n  \n  movie2.id2\n  # =\u003e 2\n\n=== Overriding the document's id `:override =\u003e true`\n\n  # app/models/movie.rb\n  class Movie\n    include MongoMapper::Document\n  \n    key :title, String \n    \n    auto_increment! :override =\u003e true\n  end\n\n  movie = Movie.create(:title =\u003e 'Pirates of Silicon Valley')\n  movie.id\n  # =\u003e 1\n\n== Do you want to improve mongomapper_id2\n\nYou’re welcome to make your contributions and send them as a pull request.\n\n=== Development\n\n  $ bundle install\n  $ bundle exec rake\n\n==== Test\n\n  $ bundle exec rake test\n\n== Copyright\n\nSee LICENSE for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphstc%2Fmongomapper_id2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphstc%2Fmongomapper_id2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphstc%2Fmongomapper_id2/lists"}