{"id":13484304,"url":"https://github.com/spohlenz/mongomodel","last_synced_at":"2025-03-27T16:30:40.768Z","repository":{"id":792169,"uuid":"489993","full_name":"spohlenz/mongomodel","owner":"spohlenz","description":"Ruby ORM for MongoDB (compatible with Rails 3)","archived":true,"fork":false,"pushed_at":"2020-02-24T07:16:52.000Z","size":808,"stargazers_count":39,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T18:42:30.733Z","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/spohlenz.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":"2010-01-26T23:13:17.000Z","updated_at":"2024-07-05T00:58:56.000Z","dependencies_parsed_at":"2022-06-21T15:25:54.216Z","dependency_job_id":null,"html_url":"https://github.com/spohlenz/mongomodel","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Fmongomodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Fmongomodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Fmongomodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Fmongomodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spohlenz","download_url":"https://codeload.github.com/spohlenz/mongomodel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882217,"owners_count":20687852,"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-07-31T17:01:22.162Z","updated_at":"2025-03-27T16:30:39.341Z","avatar_url":"https://github.com/spohlenz.png","language":"Ruby","funding_links":[],"categories":["ORM/ODM"],"sub_categories":[],"readme":"MongoModel\n==========\n\nMongoModel is a Ruby ORM for interfacing with [MongoDB](http://www.mongodb.org/) databases.\n\n[![Build Status](https://travis-ci.org/spohlenz/mongomodel.png?branch=master)](https://travis-ci.org/spohlenz/mongomodel)\n\n\nInstallation\n============\n\nMongoModel is distributed as a gem. Install with:\n\n    gem install mongomodel\n\nFor performance, you should probably also install the BSON C extensions:\n\n    gem install bson_ext\n\n\nUsing with Rails\n================\n\nAdd MongoModel to your Gemfile (and run `bundle install`):\n\n    gem 'mongomodel'\n\nCreate the configuration file `config/mongomodel.yml`:\n\n    rails generate mongo_model:config DATABASENAME\n\nGenerating a model/document:\n\n    rails generate model Article title:string body:string published_at:time approved:boolean \n\nGenerating an embedded document:\n\n    rails generate model Chapter title:string body:string -E\n\n\nSample Model\n============\n\n    class Article \u003c MongoModel::Document\n      property :title, String, :default =\u003e 'Untitled'\n      property :body, String\n      property :published_at, Time, :protected =\u003e true\n      property :approved, Boolean, :default =\u003e false, :protected =\u003e true\n      \n      timestamps!\n      \n      validates_presence_of :title, :body\n      \n      belongs_to :author, :class =\u003e User\n      \n      scope :published, where(:published_at.ne =\u003e nil)\n    end\n    \n\nConfiguration\n=============\n\nMongoModel can be configured similarly to ActiveRecord by creating/editing `config/mongomodel.yml`. The most basic configuration might look like:\n\n```yaml\ndevelopment:\n  database: mymongodbname\n  host: localhost\n  port: 27017\n```\n\nThe config file also supports specifying the username, password, pool_size, password and replicas. Running `rails generate mongo_model:config DATABASENAME` will generate a basic config file for you.\n\nUsing Replica Sets\n------------------\n\nWhen working with replica sets, replace the host/port configuration with an array of replicas (`host:port`):\n\n```yaml\nproduction:\n  database: database_name\n  replicas:\n    - some.host.com:27017\n    - another.host.com:27017\n  username: username\n  password: password\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspohlenz%2Fmongomodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspohlenz%2Fmongomodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspohlenz%2Fmongomodel/lists"}